/* =========================================================
   corefilms — cinematic streaming interface
   ========================================================= */
:root {
  --bg: #09090b;
  --bg-soft: #0d0d10;
  --panel: #131317;
  --panel-2: #18181e;
  --panel-3: #1e1e25;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .16);
  --text: #f3f3f5;
  --muted: #9b9ba5;
  --muted-2: #6e6e79;
  --accent: #a78bfa;
  --accent-strong: #c4b5fd;
  --accent-dim: rgba(167, 139, 250, .14);
  --green: #6ee7a8;
  --red: #f87171;
  --sidebar: 246px;
  --topbar: 76px;
  --radius: 18px;
  --radius-lg: 26px;
  --shadow: 0 24px 70px rgba(0, 0, 0, .5);
  --ease: cubic-bezier(.22, .7, .2, 1);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(167, 139, 250, .08), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, rgba(110, 130, 255, .04), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }
::selection { background: rgba(167, 139, 250, .3); color: #fff; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ============ shell ============ */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  padding: 26px 18px 18px;
  background: linear-gradient(180deg, #101013 0%, #0b0b0e 100%);
  border-right: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 10px;
  margin-bottom: 30px;
}
.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #d8b4fe, #7c3aed);
  color: #1a0b2e;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -.05em;
  box-shadow: 0 8px 24px rgba(167, 139, 250, .22), inset 0 1px rgba(255, 255, 255, .5);
}
.brand-word {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .06em;
}
.brand-word .dot { color: var(--accent); }
.side-nav { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; flex: 1; padding-bottom: 14px; }
.nav-label {
  padding: 0 12px;
  margin: 6px 0 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.nav-label-gap { margin-top: 22px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 43px;
  padding: 0 12px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .18s, color .18s, transform .18s;
}
.nav-item .ic { width: 19px; height: 19px; opacity: .85; }
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, .045); }
.nav-item.active { color: #fff; background: #1d1d23; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .035); }
.nav-item.active .ic { color: var(--accent); opacity: 1; }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 50%;
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  transform: translateY(-50%);
}
.nav-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}
.nav-anime .ic { color: #c5a8ff; }
.nav-anime.active .ic { color: #c5a8ff; }
.sidebar-footer { border-top: 1px solid var(--line); padding-top: 14px; }
.profile-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 14px;
  text-align: left;
  transition: background .18s;
}
.profile-card:hover { background: rgba(255, 255, 255, .05); }
.profile-card .ic { width: 15px; height: 15px; color: var(--muted-2); margin-left: auto; }
.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(145deg, #c4b5fd, #7c3aed);
  color: #1a0b2e;
  font-weight: 700;
  font-size: 14px;
  flex: 0 0 auto;
  text-transform: uppercase;
}
.profile-copy { display: flex; flex-direction: column; min-width: 0; }
.profile-copy strong { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-copy small { font-size: 11px; color: var(--muted-2); }
.sidebar-note { padding: 12px 11px 0; font-size: 10.5px; line-height: 1.5; color: var(--muted-2); }

.main { width: calc(100% - var(--sidebar)); margin-left: var(--sidebar); min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 34px;
  background: rgba(9, 9, 11, .76);
  border-bottom: 1px solid rgba(255, 255, 255, .055);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
}
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--muted);
  transition: background .18s, color .18s;
}
.icon-btn:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.icon-btn .ic { width: 19px; height: 19px; }
.notify-dot {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg);
}
.top-avatar { width: 34px; height: 34px; font-size: 12px; border: 2px solid rgba(255, 255, 255, .15); cursor: pointer; }
.mobile-menu, .mobile-brand { display: none; }

.search-wrap {
  position: relative;
  width: min(620px, 48vw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 13px;
  background: #151519;
  border: 1px solid rgba(255, 255, 255, .075);
  border-radius: 14px;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.search-wrap:focus-within { border-color: rgba(167, 139, 250, .45); box-shadow: 0 0 0 3px rgba(167, 139, 250, .09); background: #17171c; }
.search-wrap .search-icon { color: var(--muted-2); width: 18px; height: 18px; }
.search-wrap input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: 0;
  font-size: 13.5px;
  color: var(--text);
}
.search-wrap input::placeholder { color: var(--muted-2); }
.search-wrap kbd {
  font-family: var(--font);
  font-size: 11px;
  color: var(--muted-2);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .025);
  border-radius: 6px;
  padding: 2px 7px;
}
.search-clear { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: var(--muted); }
.search-clear:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.search-clear .ic { width: 14px; height: 14px; }
.search-suggest {
  position: absolute;
  z-index: 45;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  max-height: min(70vh, 580px);
  overflow-y: auto;
  padding: 8px;
  background: rgba(18, 18, 22, .98);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
  animation: popIn .16s var(--ease);
}
.suggest-label { padding: 10px 10px 6px; font-size: 10px; text-transform: uppercase; letter-spacing: .16em; color: var(--muted-2); }
.suggest-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px;
  border-radius: 10px;
  text-align: left;
}
.suggest-row:hover, .suggest-row:focus-visible { background: rgba(255, 255, 255, .06); outline: 0; }
.suggest-row img { width: 38px; height: 54px; object-fit: cover; border-radius: 7px; background: var(--panel-3); }
.suggest-row .suggest-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.suggest-row strong { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-row small { font-size: 11px; color: var(--muted-2); }
.suggest-row .suggest-type { margin-left: auto; font-size: 9.5px; letter-spacing: .1em; color: var(--accent); border: 1px solid rgba(167, 139, 250, .3); background: rgba(167, 139, 250, .08); padding: 2px 7px; border-radius: 99px; text-transform: uppercase; }
.suggest-all { display: block; width: 100%; text-align: center; padding: 11px; color: var(--accent); font-size: 12.5px; border-top: 1px solid var(--line); margin-top: 6px; }

/* ============ views ============ */
.view {
  padding: 28px 34px 100px;
  max-width: 1760px;
  margin: 0 auto;
  animation: fadeUp .35s var(--ease);
}
.view:focus { outline: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--accent);
}
.page-title { margin-top: 8px; font-size: clamp(30px, 3.4vw, 44px); font-weight: 300; letter-spacing: -.035em; line-height: 1.08; }
.page-copy { margin-top: 10px; max-width: 620px; color: var(--muted); font-size: 13.5px; }
.page-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ============ hero ============ */
.hero {
  position: relative;
  height: clamp(480px, 61vh, 660px);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #141418;
  isolation: isolate;
  margin-bottom: 42px;
}
.hero-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 28%; transform: scale(1.02); animation: heroDrift 18s ease-in-out infinite alternate; }
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(7, 7, 9, .94) 0%, rgba(7, 7, 9, .72) 34%, rgba(7, 7, 9, .1) 68%, rgba(7, 7, 9, .2) 100%),
    linear-gradient(0deg, rgba(7, 7, 9, .92) 0%, transparent 46%, rgba(7, 7, 9, .12) 100%);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(80% 80% at 15% 80%, rgba(167, 139, 250, .1), transparent 60%);
  mix-blend-mode: screen;
}
.hero-content { position: absolute; z-index: 2; left: 0; bottom: 0; width: min(730px, 66%); padding: 48px 52px 54px; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 11px;
  margin-bottom: 18px;
  border-radius: 8px;
  background: rgba(14, 14, 17, .74);
  border: 1px solid rgba(255, 255, 255, .13);
  backdrop-filter: blur(16px);
  font-size: 11px;
  font-weight: 500;
  color: #e9e9ee;
}
.hero-badge .ic { width: 14px; height: 14px; color: var(--accent); }
.hero-title {
  font-size: clamp(42px, 5.5vw, 74px);
  font-weight: 300;
  letter-spacing: -.045em;
  line-height: .98;
  text-wrap: balance;
  text-shadow: 0 10px 40px rgba(0, 0, 0, .35);
}
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 0; margin-top: 18px; color: #d2d2d8; font-size: 12.5px; }
.hero-meta span { display: inline-flex; align-items: center; }
.hero-meta span + span::before { content: ""; width: 3px; height: 3px; border-radius: 50%; background: var(--muted-2); margin: 0 12px; }
.hero-meta .rating { color: var(--accent-strong); font-weight: 600; }
.hero-copy { margin-top: 16px; max-width: 590px; color: #bbbcc4; font-size: 14px; line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero-actions { display: flex; align-items: center; gap: 10px; margin-top: 26px; flex-wrap: wrap; }
.hero-pagination { position: absolute; z-index: 3; bottom: 26px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 5px; }
.hero-dot { width: 26px; height: 15px; padding: 0; display: grid; place-items: center; }
.hero-dot::after { content: ""; width: 100%; height: 3px; border-radius: 9px; background: rgba(255, 255, 255, .3); transition: background .2s, width .2s; }
.hero-dot.active::after { background: #fff; }
.hero-side-note { position: absolute; z-index: 2; right: 34px; bottom: 38px; font-size: 10px; letter-spacing: .18em; line-height: 1.8; text-align: right; color: rgba(255, 255, 255, .48); text-transform: uppercase; }
.hero-side-note strong { color: #fff; font-weight: 500; }

/* ============ buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 44px;
  padding: 0 21px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.005em;
  white-space: nowrap;
  transition: transform .18s var(--ease), background .18s, border-color .18s, color .18s, box-shadow .18s;
}
.btn:active { transform: scale(.97); }
.btn .ic { width: 17px; height: 17px; }
.btn-light { background: #f7f7f8; color: #101013; box-shadow: 0 8px 26px rgba(0, 0, 0, .25); }
.btn-light:hover { background: #fff; box-shadow: 0 10px 34px rgba(255, 255, 255, .13); }
.btn-ghost { background: rgba(18, 18, 22, .42); border-color: rgba(255, 255, 255, .22); color: #fff; backdrop-filter: blur(14px); }
.btn-ghost:hover { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .34); }
.btn-accent { background: linear-gradient(145deg, #d8b4fe, #7c3aed); color: #1a0b2e; box-shadow: 0 10px 30px rgba(167, 139, 250, .18); }
.btn-accent:hover { filter: brightness(1.06); }
.btn-quiet { background: rgba(255, 255, 255, .055); border-color: var(--line); color: var(--text); }
.btn-quiet:hover { background: rgba(255, 255, 255, .09); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 11.5px; gap: 6px; }
.btn-sm .ic { width: 14px; height: 14px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ============ sections / rows ============ */
.section { margin-top: 44px; }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 17px; }
.section-title { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 500; letter-spacing: -.025em; }
.section-title .ic { width: 17px; height: 17px; color: var(--accent); }
.section-sub { margin-top: 3px; font-size: 11.5px; color: var(--muted-2); }
.section-link { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 500; transition: color .18s; }
.section-link:hover { color: #fff; }
.section-link .ic { width: 14px; height: 14px; }
.row-wrap { position: relative; }
.row {
  display: flex;
  gap: 15px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  padding: 2px 2px 8px;
  margin: -2px;
}
.row::-webkit-scrollbar { display: none; }
.row > * { scroll-snap-align: start; }
.row-arrow {
  position: absolute;
  z-index: 5;
  top: 38%;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(20, 20, 24, .86);
  border: 1px solid rgba(255, 255, 255, .13);
  color: #fff;
  backdrop-filter: blur(12px);
  opacity: 0;
  transform: translateY(-50%) scale(.92);
  transition: opacity .18s, transform .18s, background .18s;
}
.row-wrap:hover .row-arrow { opacity: 1; transform: translateY(-50%) scale(1); }
.row-arrow:hover { background: #26262e; }
.row-arrow.prev { left: -14px; }
.row-arrow.next { right: -14px; }
.row-arrow .ic { width: 17px; height: 17px; }

/* ============ cards ============ */
.card { position: relative; width: 166px; flex: 0 0 166px; }
.card-poster {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 13px;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid rgba(255, 255, 255, .055);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .16);
  transition: transform .24s var(--ease), box-shadow .24s, border-color .24s;
  text-align: left;
}
.card-poster img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease), filter .3s; }
.card:hover .card-poster { transform: translateY(-5px); border-color: rgba(255, 255, 255, .18); box-shadow: 0 20px 45px rgba(0, 0, 0, .42); }
.card:hover .card-poster img { transform: scale(1.045); filter: brightness(.8); }
.card-poster::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0, 0, 0, .68), transparent 45%); opacity: 0; transition: opacity .25s; }
.card:hover .card-poster::after { opacity: 1; }
.card-play {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: #111;
  transform: translate(-50%, -50%) scale(.7);
  opacity: 0;
  transition: opacity .22s, transform .22s var(--ease);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
.card-play .ic { width: 18px; height: 18px; margin-left: 2px; }
.card:hover .card-play { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.card-badge {
  position: absolute;
  z-index: 2;
  left: 9px;
  top: 9px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 21px;
  padding: 0 7px;
  border-radius: 6px;
  background: rgba(9, 9, 11, .72);
  border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(10px);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #fff;
}
.card-badge.sub { left: auto; right: 9px; color: #e9d5ff; border-color: rgba(167, 139, 250, .3); background: rgba(167, 139, 250, .12); }
.card-save {
  position: absolute;
  z-index: 3;
  right: 9px;
  top: 9px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(12, 12, 15, .7);
  border: 1px solid rgba(255, 255, 255, .15);
  color: #fff;
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .2s, transform .2s, background .2s, color .2s;
}
.card:hover .card-save, .card-save.saved { opacity: 1; transform: none; }
.card-save:hover { background: rgba(255, 255, 255, .16); }
.card-save.saved { color: var(--accent); border-color: rgba(167, 139, 250, .45); background: rgba(167, 139, 250, .15); }
.card-save .ic { width: 15px; height: 15px; }
.card-info { padding: 10px 3px 0; }
.card-title { font-size: 13px; font-weight: 500; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { margin-top: 4px; display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted-2); }
.card-meta .dot { width: 2px; height: 2px; border-radius: 50%; background: var(--muted-2); }
.card-meta .star { display: inline-flex; align-items: center; gap: 3px; color: var(--accent); }
.card-meta .star .ic { width: 11px; height: 11px; fill: currentColor; stroke: none; }
.card-progress { height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .12); margin-top: 7px; overflow: hidden; }
.card-progress span { display: block; height: 100%; border-radius: 3px; background: var(--accent); }

/* landscape continue cards */
.card-wide { width: 292px; flex: 0 0 292px; }
.card-wide .card-poster { aspect-ratio: 16 / 9; }
.card-wide .card-info { padding-top: 9px; }
.card-wide .card-title { font-size: 13.5px; }
.card-wide .play-mini {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: #101013;
  opacity: 0;
  transform: scale(.8);
  transition: .2s;
}
.card-wide:hover .play-mini { opacity: 1; transform: scale(1); }
.card-wide .play-mini .ic { width: 14px; height: 14px; margin-left: 1px; }
.card-wide .episode-tag { position: absolute; z-index: 2; left: 10px; bottom: 10px; font-size: 10px; padding: 4px 8px; border-radius: 6px; background: rgba(8, 8, 10, .75); border: 1px solid rgba(255, 255, 255, .12); backdrop-filter: blur(8px); }
.wide-progress { position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, .18); }
.wide-progress span { display: block; height: 100%; background: var(--accent); }

/* grids */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 28px 16px;
}
.grid .card { width: 100%; flex: none; }
.grid-empty { padding: 60px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 20px; background: rgba(255, 255, 255, .015); }
.grid-empty .ic { width: 32px; height: 32px; margin-bottom: 12px; color: var(--muted-2); }
.grid-empty h3 { font-size: 17px; font-weight: 500; color: var(--text); }
.grid-empty p { margin-top: 6px; font-size: 13px; }

/* filter chips */
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 24px; }
.chip {
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .025);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  transition: background .18s, border-color .18s, color .18s;
}
.chip:hover { color: #fff; border-color: var(--line-strong); background: rgba(255, 255, 255, .06); }
.chip.active { background: #f4f4f6; color: #111; border-color: #f4f4f6; }
.chip.anime-chip.active { background: #c5a8ff; border-color: #c5a8ff; color: #160e26; }
.filter-divider { width: 1px; height: 22px; background: var(--line); margin: 0 3px; }

/* segmented */
.segmented { display: inline-flex; align-items: center; gap: 3px; padding: 3px; background: #141418; border: 1px solid var(--line); border-radius: 11px; }
.segmented button { height: 30px; padding: 0 12px; border-radius: 8px; font-size: 11.5px; color: var(--muted); }
.segmented button.active { background: #2a2a32; color: #fff; }

/* ============ catalog tiles ============ */
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.catalog-tile {
  position: relative;
  overflow: hidden;
  min-height: 128px;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, #1a1a20, #121216);
  text-align: left;
  transition: transform .22s var(--ease), border-color .22s;
}
.catalog-tile:hover { transform: translateY(-3px); border-color: rgba(167, 139, 250, .3); }
.catalog-tile::after { content: attr(data-letter); position: absolute; right: 10px; bottom: -26px; font-size: 110px; font-weight: 700; line-height: 1; color: rgba(255, 255, 255, .035); }
.catalog-tile h3 { font-size: 19px; font-weight: 500; letter-spacing: -.02em; }
.catalog-tile p { margin-top: 5px; font-size: 11.5px; color: var(--muted-2); }
.catalog-tile .tile-count { display: inline-flex; margin-top: 20px; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }

/* ============ detail ============ */
.detail { margin: -28px -34px 0; }
.detail-hero { position: relative; height: min(62vh, 620px); min-height: 420px; overflow: hidden; isolation: isolate; }
.detail-hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 24%; filter: saturate(.95); }
.detail-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(9, 9, 11, .9) 0%, rgba(9, 9, 11, .35) 55%, rgba(9, 9, 11, .5) 100%),
    linear-gradient(0deg, var(--bg) 0%, rgba(9, 9, 11, .35) 35%, transparent 68%);
}
.detail-topbar { position: absolute; z-index: 3; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: 22px 34px; }
.back-link { display: inline-flex; align-items: center; gap: 9px; height: 38px; padding: 0 14px 0 10px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .16); background: rgba(10, 10, 12, .55); backdrop-filter: blur(14px); font-size: 12px; color: #fff; }
.back-link:hover { background: rgba(255, 255, 255, .1); }
.back-link .ic { width: 16px; height: 16px; }
.detail-layout {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 34px;
  align-items: start;
  padding: 0 34px 60px;
  margin-top: -200px;
  max-width: 1760px;
  margin-left: auto;
  margin-right: auto;
}
.detail-main { min-width: 0; }
.detail-head { display: flex; align-items: flex-end; gap: 28px; }
.detail-poster {
  width: 208px;
  flex: 0 0 208px;
  aspect-ratio: 2 / 3;
  border-radius: 16px;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 30px 70px rgba(0, 0, 0, .55);
}
.detail-poster img { width: 100%; height: 100%; object-fit: cover; }
.detail-copy { min-width: 0; padding-bottom: 6px; }
.detail-kicker { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 6px; border: 1px solid var(--line-strong); background: rgba(255, 255, 255, .05); font-size: 9.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #ddd; }
.pill.accent { background: rgba(167, 139, 250, .12); border-color: rgba(167, 139, 250, .3); color: var(--accent-strong); }
.pill.anime { background: rgba(197, 168, 255, .12); border-color: rgba(197, 168, 255, .32); color: #d6c2ff; }
.detail-title { font-size: clamp(34px, 4.2vw, 58px); font-weight: 300; letter-spacing: -.045em; line-height: 1.02; text-wrap: balance; }
.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; color: var(--muted); font-size: 12.5px; }
.detail-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted-2); }
.detail-meta .rating { color: var(--accent); font-weight: 600; }
.detail-desc { margin-top: 16px; max-width: 760px; color: #b9bac2; font-size: 13.5px; line-height: 1.7; }
.detail-genres { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 15px; }
.genre-tag { height: 26px; display: inline-flex; align-items: center; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, .025); font-size: 10.5px; color: var(--muted); }
.detail-actions { display: flex; align-items: center; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.detail-subnote { display: flex; align-items: center; gap: 7px; margin-top: 12px; font-size: 11px; color: var(--muted-2); }
.detail-subnote .ic { width: 13px; height: 13px; color: var(--green); }

/* server panel */
.panel { background: rgba(19, 19, 23, .86); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; backdrop-filter: blur(8px); }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.panel-head h3 { font-size: 13px; font-weight: 600; }
.panel-head .sub { font-size: 10.5px; color: var(--muted-2); }
.panel-head .spacer { flex: 1; }
.panel-head .icon-btn { width: 30px; height: 30px; }
.panel-head .icon-btn .ic { width: 14px; height: 14px; }
.panel-body { padding: 16px 18px 18px; }
.server-note { font-size: 10.5px; color: var(--muted-2); margin-top: 10px; line-height: 1.5; }
.server-status { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; padding: 14px 2px; }
.spinner { width: 15px; height: 15px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .16); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: 0 0 auto; }
.server-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; max-height: 270px; overflow-y: auto; padding-right: 4px; }
.server-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  flex: 0 0 auto;
  padding: 9px 10px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, .025);
  text-align: left;
  transition: background .16s, border-color .16s;
}
.server-row:hover { background: rgba(255, 255, 255, .06); border-color: var(--line); }
.server-row.selected { border-color: rgba(167, 139, 250, .45); background: rgba(167, 139, 250, .07); }
.server-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: rgba(255, 255, 255, .05); color: var(--accent); }
.server-icon .ic { width: 15px; height: 15px; }
.server-copy { min-width: 0; }
.server-copy strong { display: block; font-size: 11.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.server-copy small { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 9.5px; color: var(--muted-2); }
.server-copy small .dot { width: 2px; height: 2px; border-radius: 50%; background: var(--muted-2); }
.q-badge { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 4px; font-size: 9px; font-weight: 700; letter-spacing: .04em; border: 1px solid var(--line); color: #ccc; background: rgba(255, 255, 255, .04); }
.q-badge.q4k { color: #e9d5ff; border-color: rgba(167, 139, 250, .35); background: rgba(167, 139, 250, .1); }
.q-badge.q1080 { color: #d2d2d8; }
.q-badge.q720 { color: #9b9ba5; }
.server-play { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: rgba(255, 255, 255, .9); color: #111; }
.server-play .ic { width: 12px; height: 12px; margin-left: 1px; }

/* episodes */
.episodes-panel {
  position: sticky;
  top: calc(var(--topbar) + 18px);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--topbar) - 36px);
  background: rgba(16, 16, 20, .92);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}
.episodes-head { padding: 17px 17px 13px; border-bottom: 1px solid var(--line); }
.episodes-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.episodes-title h2 { font-size: 15px; font-weight: 600; }
.episodes-title span { font-size: 10.5px; color: var(--muted-2); }
.episodes-tools { display: flex; gap: 8px; margin-top: 12px; }
.mini-select, .mini-input {
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #19191e;
  color: var(--text);
  font-size: 11.5px;
  padding: 0 10px;
  outline: 0;
}
.mini-select { max-width: 118px; }
.mini-input { flex: 1; min-width: 0; }
.mini-input::placeholder { color: var(--muted-2); }
.mini-select:focus, .mini-input:focus { border-color: rgba(167, 139, 250, .4); }
.episode-list { overflow-y: auto; padding: 8px; flex: 1; }
.episode-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 24px;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 7px;
  border-radius: 11px;
  border: 1px solid transparent;
  text-align: left;
  transition: background .16s, border-color .16s;
}
.episode-row:hover { background: rgba(255, 255, 255, .05); }
.episode-row.active { background: rgba(167, 139, 250, .08); border-color: rgba(167, 139, 250, .28); }
.ep-thumb { position: relative; width: 72px; aspect-ratio: 16 / 9; border-radius: 7px; overflow: hidden; background: var(--panel-3); }
.ep-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ep-thumb .ep-num { position: absolute; left: 4px; bottom: 4px; font-size: 8px; font-weight: 600; padding: 2px 4px; border-radius: 3px; background: rgba(0, 0, 0, .72); }
.ep-copy { min-width: 0; }
.ep-copy strong { display: block; font-size: 11.5px; font-weight: 500; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ep-copy small { display: block; margin-top: 3px; font-size: 9.5px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ep-progress { height: 2px; margin-top: 5px; border-radius: 2px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.ep-progress span { display: block; height: 100%; background: var(--accent); }
.ep-play { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: var(--muted-2); }
.episode-row.active .ep-play, .episode-row:hover .ep-play { color: #fff; background: rgba(255, 255, 255, .08); }
.ep-play .ic { width: 11px; height: 11px; margin-left: 1px; }
.episodes-empty { padding: 38px 20px; text-align: center; color: var(--muted-2); font-size: 12px; }

/* ============ settings ============ */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 18px; align-items: start; }
.settings-card { background: rgba(19, 19, 23, .8); border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.settings-card h2 { font-size: 16px; font-weight: 500; letter-spacing: -.02em; }
.settings-card > p { margin-top: 5px; font-size: 11.5px; color: var(--muted-2); line-height: 1.6; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 0; border-top: 1px solid var(--line); }
.setting-row:first-of-type { margin-top: 10px; }
.setting-row strong { display: block; font-size: 12.5px; font-weight: 500; }
.setting-row small { display: block; margin-top: 3px; font-size: 10.5px; color: var(--muted-2); line-height: 1.5; }
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--green); }
.status-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.status-dot.off { color: var(--red); }
.field { display: flex; flex-direction: column; gap: 7px; margin-top: 12px; }
.field label { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); }
.field input, .field select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #17171c;
  outline: 0;
  font-size: 12.5px;
}
.field input:focus, .field select:focus { border-color: rgba(167, 139, 250, .4); }
.form-row { display: flex; gap: 8px; align-items: flex-end; }
.form-row .field { flex: 1; }
.form-row .btn { margin-bottom: 0; }
.key-mask { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10.5px; color: var(--muted-2); }
.toggle { position: relative; width: 42px; height: 24px; flex: 0 0 auto; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle span { position: absolute; inset: 0; border-radius: 99px; background: #2a2a32; border: 1px solid var(--line); transition: background .2s; }
.toggle span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #8a8a94; transition: transform .2s, background .2s; }
.toggle input:checked + span { background: rgba(167, 139, 250, .24); border-color: rgba(167, 139, 250, .45); }
.toggle input:checked + span::after { transform: translateX(18px); background: var(--accent); }

/* ============ modals ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(4, 4, 6, .72);
  backdrop-filter: blur(10px);
  animation: fadeIn .18s ease;
}
.modal {
  width: min(520px, 100%);
  max-height: min(86vh, 900px);
  overflow-y: auto;
  padding: 24px;
  background: linear-gradient(180deg, #1a1a20, #131317);
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: 22px;
  box-shadow: 0 40px 120px rgba(0, 0, 0, .65);
  animation: modalIn .24s var(--ease);
}
.modal.wide { width: min(680px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.modal-head h2 { font-size: 20px; font-weight: 500; letter-spacing: -.025em; }
.modal-head p { margin-top: 4px; font-size: 11.5px; color: var(--muted-2); }
.modal-close { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); background: rgba(255, 255, 255, .04); }
.modal-close:hover { color: #fff; background: rgba(255, 255, 255, .09); }
.modal-close .ic { width: 15px; height: 15px; }
.modal-section { margin-top: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.form-error { margin-top: 10px; font-size: 11px; color: var(--red); }
.form-ok { margin-top: 10px; font-size: 11px; color: var(--green); }
.profile-list { display: flex; flex-direction: column; gap: 7px; margin-top: 14px; }
.profile-row { display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px; border-radius: 12px; border: 1px solid transparent; text-align: left; }
.profile-row:hover { background: rgba(255, 255, 255, .05); }
.profile-row.active { border-color: rgba(167, 139, 250, .32); background: rgba(167, 139, 250, .07); }
.profile-row .avatar { width: 34px; height: 34px; font-size: 12px; }
.profile-row .copy { flex: 1; min-width: 0; }
.profile-row strong { display: block; font-size: 12.5px; font-weight: 500; }
.profile-row small { font-size: 10px; color: var(--muted-2); }
.subtitle-results { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; max-height: 300px; overflow-y: auto; }
.subtitle-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border-radius: 10px; background: rgba(255, 255, 255, .03); border: 1px solid transparent; text-align: left; }
.subtitle-row:hover { background: rgba(255, 255, 255, .07); border-color: var(--line); }
.subtitle-row .copy { flex: 1; min-width: 0; }
.subtitle-row strong { display: block; font-size: 11.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subtitle-row small { display: block; margin-top: 2px; font-size: 9.5px; color: var(--muted-2); }
.subtitle-row .pill { flex: 0 0 auto; }
.subtitle-status { margin-top: 12px; font-size: 11px; color: var(--muted-2); }
.local-file { display: flex; align-items: center; gap: 9px; margin-top: 12px; font-size: 11px; color: var(--muted); cursor: pointer; }
.local-file input { display: none; }
.local-file span { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); }
.local-file:hover span { background: rgba(255, 255, 255, .07); }

/* ============ player ============ */
.player {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  overflow: hidden;
  cursor: default;
  user-select: none;
}
.player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.subtitle-overlay {
  position: absolute;
  z-index: 5;
  left: 6%;
  right: 6%;
  bottom: max(92px, 11vh);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s ease, bottom .2s ease;
  text-align: center;
}
.subtitle-overlay.visible { opacity: 1; }
.subtitle-overlay .sub-line {
  display: inline-block;
  max-width: 92%;
  padding: 2px 12px 3px;
  border-radius: 5px;
  background: var(--subtitle-bg, rgba(0, 0, 0, .58));
  color: #fff;
  font-family: var(--subtitle-font, "Cairo", "Noto Naskh Arabic", sans-serif);
  font-size: calc(1.34rem * var(--subtitle-scale, 1));
  font-weight: 600;
  line-height: 1.62;
  letter-spacing: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .95), 0 0 8px rgba(0, 0, 0, .65);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.player.idle .subtitle-overlay { bottom: max(42px, 6vh); }
.player-shade { position: absolute; left: 0; right: 0; z-index: 2; pointer-events: none; transition: opacity .3s; }
.player-shade.top { top: 0; height: 210px; background: linear-gradient(180deg, rgba(0, 0, 0, .78), transparent); }
.player-shade.bottom { bottom: 0; height: 280px; background: linear-gradient(0deg, rgba(0, 0, 0, .92), transparent); }
.player-top {
  position: absolute;
  z-index: 6;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 26px;
  transition: opacity .3s, transform .3s;
}
.player-back {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(0, 0, 0, .38);
  color: #fff;
  backdrop-filter: blur(14px);
  flex: 0 0 auto;
  transition: background .18s;
}
.player-back:hover { background: rgba(255, 255, 255, .14); }
.player-back .ic { width: 19px; height: 19px; }
.player-heading { min-width: 0; padding-top: 1px; }
.player-title-line { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.player-title-line h1 { font-size: clamp(19px, 2vw, 27px); font-weight: 500; letter-spacing: -.03em; text-shadow: 0 2px 18px rgba(0, 0, 0, .5); }
.player-badges { display: inline-flex; align-items: center; gap: 5px; }
.player-badge { display: inline-flex; align-items: center; height: 19px; padding: 0 5px; border-radius: 3px; font-size: 8.5px; font-weight: 700; letter-spacing: .06em; background: rgba(255, 255, 255, .17); border: 1px solid rgba(255, 255, 255, .16); }
.player-badge.hdr { background: rgba(167, 139, 250, .24); border-color: rgba(167, 139, 250, .42); color: #f3e8ff; }
.player-badge.dolby { background: rgba(255, 255, 255, .12); }
#player-subtitle { margin-top: 3px; font-size: 11.5px; color: rgba(255, 255, 255, .62); }
.mini-info { display: grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .3); font-size: 9px; color: rgba(255, 255, 255, .7); }
.player-window { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.player-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: rgba(255, 255, 255, .82);
  transition: background .18s, color .18s;
}
.player-icon:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.player-icon .ic { width: 18px; height: 18px; }
.player-icon.text { width: auto; padding: 0 9px; gap: 6px; border-radius: 8px; font-size: 10px; }
.player-icon.text .ic { width: 17px; height: 17px; }
.player-icon.close:hover { background: rgba(248, 113, 113, .22); color: #fecaca; }
.player-center {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 150px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 34px;
  transition: opacity .3s;
}
.round-control {
  position: relative;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, .3);
  border: 1px solid rgba(255, 255, 255, .1);
  backdrop-filter: blur(8px);
  transition: background .18s, transform .18s;
}
.round-control:hover { background: rgba(255, 255, 255, .14); transform: scale(1.05); }
.round-control .ic { width: 21px; height: 21px; }
.skip-number { position: absolute; font-size: 8px; font-weight: 700; top: 17px; }
.play-control {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(15, 15, 17, .56);
  border: 2px solid rgba(255, 255, 255, .75);
  color: #fff;
  backdrop-filter: blur(10px);
  transition: transform .18s, background .18s;
}
.play-control:hover { transform: scale(1.06); background: rgba(255, 255, 255, .12); }
.play-control .ic { width: 24px; height: 24px; margin-left: 2px; }
.player-bottom {
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 28px 20px;
  transition: opacity .3s, transform .3s;
}
.timeline { display: flex; align-items: center; gap: 12px; }
.timeline .time { width: 42px; font-size: 10.5px; color: rgba(255, 255, 255, .7); font-variant-numeric: tabular-nums; }
.timeline .time:last-child { text-align: right; }
.timeline-track { position: relative; flex: 1; height: 18px; display: flex; align-items: center; }
.timeline-track::before { content: ""; position: absolute; left: 0; right: 0; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .22); }
.timeline-buffer, .timeline-played { position: absolute; left: 0; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .38); pointer-events: none; }
.timeline-played { background: var(--accent); }
#seek { position: absolute; inset: 0; width: 100%; height: 18px; opacity: 0; cursor: pointer; margin: 0; }
.timeline-track:hover::after { content: ""; position: absolute; right: 0; left: 0; height: 5px; border-radius: 5px; background: rgba(255, 255, 255, .06); pointer-events: none; }
.player-controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin-top: 8px; }
.control-group { display: flex; align-items: center; gap: 4px; }
.control-group.center { justify-content: center; }
.control-group.right { justify-content: flex-end; }
.volume { width: 88px; height: 4px; accent-color: #fff; cursor: pointer; }
.quality-pill { margin-left: 10px; font-size: 9.5px; letter-spacing: .08em; color: rgba(255, 255, 255, .65); border: 1px solid rgba(255, 255, 255, .2); border-radius: 4px; padding: 2px 5px; }
#active-sub { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player.idle { cursor: none; }
.player.idle .player-top, .player.idle .player-bottom, .player.idle .player-center { opacity: 0; pointer-events: none; }
.player.idle .player-shade { opacity: .35; }
.player-menu {
  position: absolute;
  z-index: 9;
  right: 28px;
  bottom: 112px;
  width: 360px;
  max-height: min(62vh, 520px);
  overflow-y: auto;
  padding: 8px;
  background: rgba(17, 17, 21, .97);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  backdrop-filter: blur(24px);
  animation: popIn .18s var(--ease);
}
.menu-title { padding: 9px 10px 6px; font-size: 9.5px; letter-spacing: .15em; text-transform: uppercase; color: var(--muted-2); }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 10px; border-radius: 9px; text-align: left; font-size: 11.5px; color: #d7d7dd; }
.menu-item:hover { background: rgba(255, 255, 255, .06); }
.menu-item.active { background: rgba(167, 139, 250, .1); color: #fff; }
.menu-item .check { margin-left: auto; color: var(--accent); }
.menu-item small { margin-left: auto; font-size: 9.5px; color: var(--muted-2); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-toggle { display: flex; align-items: center; justify-content: space-between; padding: 9px 10px; font-size: 11.5px; color: #d7d7dd; }
.next-card {
  position: absolute;
  z-index: 7;
  right: 28px;
  bottom: 170px;
  width: 310px;
  padding: 15px;
  background: rgba(17, 17, 21, .95);
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  animation: popIn .2s var(--ease);
}
.next-card p { font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.next-card strong { display: block; margin-top: 5px; font-size: 14px; font-weight: 500; }
.next-actions { display: flex; gap: 7px; margin-top: 12px; }
.player-message { position: absolute; z-index: 8; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(460px, 86%); padding: 18px; text-align: center; font-size: 12.5px; line-height: 1.6; color: #f4d4d4; background: rgba(60, 15, 18, .75); border: 1px solid rgba(248, 113, 113, .25); border-radius: 14px; backdrop-filter: blur(16px); }
.player-toast { position: absolute; z-index: 10; left: 50%; bottom: 88px; transform: translateX(-50%); padding: 9px 14px; border-radius: 999px; background: rgba(15, 15, 18, .9); border: 1px solid var(--line-strong); font-size: 11px; color: #eee; backdrop-filter: blur(14px); animation: fadeUp .2s ease; }

/* ============ toast ============ */
.toast {
  position: fixed;
  z-index: 200;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  max-width: min(560px, calc(100vw - 32px));
  padding: 11px 17px;
  border-radius: 11px;
  background: rgba(22, 22, 27, .96);
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
  font-size: 12px;
  color: #f2f2f5;
  text-align: center;
  backdrop-filter: blur(16px);
  animation: fadeUp .22s var(--ease);
}

/* ============ skeleton/loading ============ */
.skeleton { position: relative; overflow: hidden; background: #16161b; border-radius: 12px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .055), transparent); animation: shimmer 1.4s infinite; }
.skeleton-card { aspect-ratio: 2 / 3; width: 100%; border-radius: 13px; }
.skeleton-line { height: 11px; margin-top: 10px; border-radius: 5px; }

/* ============ responsive ============ */
@media (max-width: 1320px) {
  :root { --sidebar: 224px; }
  .view { padding-left: 26px; padding-right: 26px; }
  .topbar { padding: 0 26px; }
  .detail { margin-left: -26px; margin-right: -26px; }
  .detail-layout { padding-left: 26px; padding-right: 26px; grid-template-columns: minmax(0, 1fr) 360px; gap: 26px; }
  .hero-content { padding: 40px 42px 46px; }
  .hero-side-note { right: 26px; }
}
@media (max-width: 1120px) {
  .detail-layout { grid-template-columns: minmax(0, 1fr) 330px; }
  .detail-poster { width: 170px; flex-basis: 170px; }
  .search-wrap { width: min(520px, 44vw); }
  .card { width: 152px; flex-basis: 152px; }
  .card-wide { width: 268px; flex-basis: 268px; }
}
@media (max-width: 980px) {
  :root { --sidebar: 0px; --topbar: 68px; }
  .sidebar {
    width: 252px;
    transform: translateX(-104%);
    transition: transform .28s var(--ease);
    box-shadow: 30px 0 80px rgba(0, 0, 0, .5);
  }
  .sidebar.open { transform: none; }
  .main { width: 100%; margin-left: 0; }
  .mobile-scrim { position: fixed; inset: 0; z-index: 39; background: rgba(0, 0, 0, .62); backdrop-filter: blur(3px); }
  .mobile-menu { display: grid; }
  .mobile-brand { display: inline-flex; font-size: 16px; font-weight: 700; letter-spacing: .08em; }
  .mobile-brand span { color: var(--accent); }
  .topbar { gap: 10px; padding: 0 18px; }
  .topbar-actions .icon-btn:first-child { display: none; }
  .search-wrap { width: min(520px, 56vw); margin: 0 auto; }
  .view { padding: 22px 20px 110px; }
  .hero { height: min(64vh, 560px); border-radius: 20px; }
  .hero-content { width: min(640px, 88%); padding: 32px 30px 40px; }
  .hero-side-note { display: none; }
  .hero-title { font-size: clamp(38px, 8vw, 56px); }
  .detail { margin: -22px -20px 0; }
  .detail-layout { grid-template-columns: 1fr; margin-top: -150px; padding: 0 20px 120px; }
  .detail-hero { height: 48vh; min-height: 360px; }
  .detail-poster { width: 144px; flex-basis: 144px; }
  .detail-head { gap: 18px; align-items: flex-end; }
  .episodes-panel { position: static; max-height: 620px; margin-top: 6px; }
  .settings-grid { grid-template-columns: 1fr; }
  .mobile-nav {
    position: fixed;
    z-index: 38;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: space-around;
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
    background: rgba(12, 12, 15, .94);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(20px);
  }
  .mobile-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 52px; padding: 5px 4px; border-radius: 9px; color: var(--muted-2); font-size: 9px; }
  .mobile-nav a.active { color: #fff; background: rgba(255, 255, 255, .045); }
  .mobile-nav a.active .ic { color: var(--accent); }
  .mobile-nav .ic { width: 18px; height: 18px; }
}
@media (min-width: 981px) { .mobile-nav { display: none; } }
@media (max-width: 720px) {
  .topbar { padding: 0 14px; }
  .mobile-brand { display: none; }
  .search-wrap { width: 100%; }
  .search-wrap kbd { display: none; }
  .topbar-actions { gap: 4px; }
  .view { padding: 16px 14px 105px; }
  .hero { height: 62vh; min-height: 420px; border-radius: 18px; margin-bottom: 30px; }
  .hero-content { width: 100%; padding: 22px 20px 40px; }
  .hero-copy { -webkit-line-clamp: 2; font-size: 12.5px; }
  .hero-actions .btn { height: 40px; padding: 0 16px; font-size: 12px; }
  .hero-title { font-size: 38px; }
  .hero-pagination { bottom: 17px; }
  .section { margin-top: 32px; }
  .section-title { font-size: 17px; }
  .card { width: 132px; flex-basis: 132px; }
  .card-wide { width: 236px; flex-basis: 236px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 22px 12px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .page-title { font-size: 30px; }
  .detail { margin: -16px -14px 0; }
  .detail-layout { margin-top: -110px; padding: 0 14px 110px; gap: 18px; }
  .detail-hero { min-height: 300px; height: 42vh; }
  .detail-topbar { padding: 14px; }
  .detail-head { flex-direction: column; align-items: flex-start; gap: 14px; }
  .detail-poster { width: 112px; flex-basis: 112px; }
  .detail-title { font-size: 32px; }
  .detail-desc { font-size: 12.5px; }
  .detail-actions .btn { flex: 1; min-width: 0; }
  .server-list { max-height: none; }
  .episodes-panel { max-height: 560px; }
  .player-top { padding: 12px 14px; }
  .player-window .player-icon:not(.close) { display: none; }
  .player-title-line h1 { font-size: 17px; }
  .player-center { bottom: 128px; gap: 22px; }
  .play-control { width: 58px; height: 58px; }
  .round-control { width: 42px; height: 42px; }
  .player-bottom { padding: 0 14px 14px; }
  .player-controls { grid-template-columns: 1fr auto; }
  .control-group.right { display: none; }
  .volume { display: none; }
  .quality-pill { margin-left: 2px; }
  .player-menu { right: 10px; left: 10px; width: auto; bottom: 100px; max-height: 62vh; }
  .next-card { right: 12px; left: 12px; width: auto; bottom: 150px; }
  .modal { padding: 20px; }
  .modal-backdrop { padding: 12px; }
  .toast { bottom: 82px; }
}
@media (max-width: 420px) {
  .hero { min-height: 390px; }
  .hero-title { font-size: 32px; }
  .hero-meta { font-size: 11px; }
  .hero-meta span + span::before { margin: 0 8px; }
  .section-title { font-size: 16px; }
  .profile-copy small { display: none; }
}

/* ============ animations ============ */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 100% { transform: translateX(100%); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: translateY(5px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes heroDrift { from { transform: scale(1.02) translate3d(0, 0, 0); } to { transform: scale(1.07) translate3d(0, -1%, 0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .25); background-clip: padding-box; border: 2px solid transparent; }

/* ------------------------------------------------------------------
   SUBTITLE TYPOGRAPHY
   Native <track> cues are styled through ::cue. The settings panel writes
   --subtitle-font / --subtitle-size / --subtitle-bg on <html>.
   ------------------------------------------------------------------ */
video::cue, #video::cue {
  font-family: var(--subtitle-font, "Cairo", "Noto Naskh Arabic", "Tajawal", sans-serif);
  font-size: var(--subtitle-size, 100%);
  font-weight: 600;
  line-height: 1.45;
  color: #fff;
  background: var(--subtitle-bg, rgba(0, 0, 0, .58));
  text-shadow: 0 1px 2px rgba(0, 0, 0, .9), 0 0 10px rgba(0, 0, 0, .75);
}
video::-webkit-media-text-track-container { font-family: var(--subtitle-font, "Cairo", sans-serif); }

/* ------------------------------------------------------------------
   corefilms player upgrades: skip intro, speed, menu chips, fit mode
   ------------------------------------------------------------------ */
#video { object-fit: contain; background: #000; transition: object-fit .2s ease; }
#video.fit-cover { object-fit: cover; }
.skip-intro {
  position: absolute; z-index: 9; right: 28px; bottom: 116px;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: 999px;
  background: rgba(16, 14, 22, .88); color: #fff;
  border: 1px solid rgba(167, 139, 250, .5);
  font-size: 12.5px; font-weight: 600; letter-spacing: .01em;
  backdrop-filter: blur(16px); box-shadow: 0 10px 30px rgba(0,0,0,.45);
  animation: fadeUp .22s ease;
}
.skip-intro:hover { background: rgba(167, 139, 250, .22); border-color: var(--accent); }
.skip-intro span { font-size: 17px; line-height: 1; color: var(--accent); }
.player.idle .skip-intro { opacity: 0; pointer-events: none; }
.speed-btn { min-width: 38px; font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.speed-btn span { line-height: 1; }
.menu-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 10px 8px; }
.menu-chip {
  min-height: 30px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--line); background: rgba(255,255,255,.035);
  color: #d7d7dd; font-size: 10.5px; font-weight: 500;
}
.menu-chip:hover { background: rgba(255,255,255,.08); }
.menu-chip.active { border-color: rgba(167,139,250,.55); background: rgba(167,139,250,.14); color: #fff; }
.menu-item .menu-note { margin-left: auto; font-size: 9px; color: var(--muted-2); }
.player-menu .menu-toggle { gap: 10px; }

/* season picker */
.season-select-wrap { position: relative; flex: 1; min-width: 0; }
.season-select {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; height: 36px; padding: 0 11px;
  border-radius: 10px; border: 1px solid var(--line);
  background: linear-gradient(180deg, #1d1d23, #17171c);
  color: var(--text); font-size: 11.5px; font-weight: 500;
  text-align: left;
}
.season-select:hover { border-color: rgba(167,139,250,.35); }
.season-select .ic { width: 13px; height: 13px; color: var(--muted-2); transition: transform .18s; }
.season-select[aria-expanded="true"] .ic { transform: rotate(180deg); }
.season-menu {
  position: absolute; z-index: 12; top: calc(100% + 6px); left: 0; right: 0;
  max-height: 240px; overflow-y: auto; padding: 6px;
  border-radius: 12px; border: 1px solid var(--line-strong);
  background: rgba(18,18,23,.98); box-shadow: 0 18px 40px rgba(0,0,0,.55);
  backdrop-filter: blur(18px);
}
.season-option {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 9px 10px; border-radius: 8px;
  color: #d7d7dd; font-size: 11.5px; text-align: left;
}
.season-option:hover { background: rgba(255,255,255,.07); }
.season-option.active { background: rgba(167,139,250,.14); color: #fff; }
.season-option small { color: var(--muted-2); font-size: 9.5px; }
.episodes-tools .season-select-wrap { max-width: 160px; }

/* episode rail polish */
.episode-list { padding: 10px; display: flex; flex-direction: column; gap: 3px; }
.episode-row { grid-template-columns: 92px minmax(0, 1fr) 28px; gap: 11px; padding: 8px; border-radius: 12px; }
.ep-thumb { width: 92px; border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.ep-thumb .ep-num { left: 5px; bottom: 5px; font-size: 8.5px; padding: 2px 5px; }
.ep-copy strong { font-size: 12px; }
.ep-copy small { font-size: 10px; }
.ep-play { width: 28px; height: 28px; }
.ep-play .ic { width: 12px; height: 12px; }
.episodes-title h2 { font-size: 15.5px; }

/* server list polish */
.server-list { gap: 7px; max-height: 340px; }
.server-row {
  padding: 10px 11px;
  border: 1px solid rgba(255,255,255,.055);
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.018));
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.server-row:hover { transform: translateY(-1px); border-color: rgba(167,139,250,.28); box-shadow: 0 8px 22px rgba(0,0,0,.28); }
.server-row.selected { border-color: rgba(167,139,250,.55); background: linear-gradient(180deg, rgba(167,139,250,.14), rgba(167,139,250,.055)); }
.server-row.no-audio { opacity: .58; }
.server-copy strong { font-size: 12px; }
.server-copy small { font-size: 10px; gap: 5px; }
.server-row .q-badge { height: 21px; font-size: 9px; }
.server-play { width: 30px; height: 30px; }

/* top-10 title containment */
.pl-top10 .card.pl-t10 { width: 166px; flex-basis: 166px; padding-left: 64px; min-width: 0; }
.pl-top10 .card.pl-t10 .card-poster { width: 166px; }
.pl-top10 .card.pl-t10 .card-info { min-width: 0; width: 100%; }
.pl-top10 .card.pl-t10 .card-title { display: block; width: 100%; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 720px) {
  .skip-intro { right: 14px; bottom: 104px; padding: 9px 14px; font-size: 11.5px; }
  .episode-row { grid-template-columns: 76px minmax(0, 1fr) 26px; gap: 9px; }
  .ep-thumb { width: 76px; }
  .season-menu { max-height: 200px; }
}
