/* ==========================================================================
   Otaku World — "Midnight" theme
   Dark navy, white type, one calm blue accent; violet only for small details.
   Content (posters, banners) is the star; chrome stays quiet.
   Logical properties (inline-start/end) keep RTL (Persian) working.
   ========================================================================== */

:root {
  /* surfaces */
  --bg: #0b1020;
  --bg-2: #0e1428;
  --surface: #141a2f;
  --surface-2: #1b2240;
  --surface-3: #232b4d;
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .16);
  --header-bg: rgba(11, 16, 32, .82);

  /* type */
  --text: #f1f4ff;
  --text-2: #c3c9e0;
  --muted: #8b93b3;

  /* accents */
  --accent: #3b6ef5;          /* buttons (white text passes AA) */
  --accent-hover: #2f5fe0;
  --accent-text: #8aabff;     /* links / active states on dark */
  --accent-soft: rgba(91, 140, 255, .14);
  --violet: #8b7cf6;          /* small details only */
  --gold: #f5c451;
  --success: #34d399;
  --danger: #f87171;
  --warning: #fbbf24;

  --hero-overlay: linear-gradient(0deg, var(--bg) 0%, rgba(11, 16, 32, .75) 30%, rgba(11, 16, 32, .15) 70%, rgba(11, 16, 32, .35) 100%);
  --hero-side: linear-gradient(var(--hero-dir, 90deg), rgba(11, 16, 32, .92) 0%, rgba(11, 16, 32, .55) 40%, transparent 75%);

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 28px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, .5);
  --header-h: 64px;
  --font: "Inter", "Vazirmatn", system-ui, sans-serif;
  color-scheme: dark;
}
[dir="rtl"] { --hero-dir: 270deg; }

:root[data-theme="light"] {
  --bg: #f5f6fa;
  --bg-2: #eef0f6;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --surface-3: #e6e9f2;
  --border: rgba(17, 24, 39, .08);
  --border-strong: rgba(17, 24, 39, .16);
  --header-bg: rgba(255, 255, 255, .86);
  --text: #111827;
  --text-2: #374151;
  --muted: #6b7280;
  --accent: #2e5bea;
  --accent-hover: #2449c4;
  --accent-text: #2e5bea;
  --accent-soft: rgba(46, 91, 234, .1);
  --violet: #6d5ce8;
  --gold: #b7791f;
  --success: #059669;
  --danger: #dc2626;
  --warning: #b45309;
  --shadow: 0 6px 20px rgba(17, 24, 39, .08);
  --shadow-lg: 0 16px 40px rgba(17, 24, 39, .14);
  color-scheme: light;
}

html[lang="fa"] { --font: "Vazirmatn", "Inter", system-ui, sans-serif; }
html[lang="ja"] { --font: "Noto Sans JP", "Inter", system-ui, sans-serif; }
html[lang="zh-hans"] { --font: "Noto Sans SC", "Inter", system-ui, sans-serif; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 15px; line-height: 1.65; min-height: 100vh; display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent); color: #fff; }
.container { width: 100%; max-width: 2200px; margin-inline: auto; padding-inline: clamp(16px, 3.5vw, 64px); }
main { flex: 1; padding-block: 24px 56px; }
.muted { color: var(--muted); }
.ltr { direction: ltr; unicode-bidi: embed; }
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }

/* ---------------------------------------------------------------- header */
.site-header {
  position: sticky; top: 0; z-index: 50; background: var(--header-bg);
  backdrop-filter: saturate(140%) blur(14px); -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 20px; height: var(--header-h); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; white-space: nowrap; }
.logo-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; color: #fff; }
.logo-mark .icon { width: 15px; height: 15px; }
.logo-text { color: var(--text); }
.main-nav { display: flex; gap: 2px; }
.main-nav a { padding: 8px 12px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; font-size: .95rem; transition: color .15s; }
.main-nav a:hover { color: var(--text); }
.main-nav a.active { color: var(--text); font-weight: 700; }
.header-search { flex: 1; max-width: 380px; margin-inline-start: auto; position: relative; }
.header-search input {
  width: 100%; height: 40px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); padding-inline: 40px 16px; outline: none; transition: border-color .15s, background .15s;
}
.header-search input::placeholder { color: var(--muted); }
.header-search input:focus { border-color: var(--accent); background: var(--surface-2); }
.header-search .icon { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%;
  border: 0; background: transparent; cursor: pointer; color: var(--text-2); transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; inset-inline-end: 0; top: calc(100% + 10px); min-width: 200px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 60;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; background: none;
  border-radius: var(--radius-sm); cursor: pointer; text-align: start; color: var(--text-2);
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); color: var(--text); }
.dropdown-menu .active { color: var(--accent-text); font-weight: 600; }
.dropdown-menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.dropdown-head { padding: 8px 12px 10px; }
.dropdown-head strong { display: block; color: var(--text); }

.avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: var(--surface-3); color: var(--text);
  display: grid; place-items: center; font-weight: 700; flex: none; overflow: hidden; }
.avatar.sm { width: 32px; height: 32px; font-size: .85rem; }
.avatar.lg { width: 96px; height: 96px; font-size: 2rem; border: 3px solid var(--surface); }
.avatar-btn { border: 0; padding: 0; background: none; cursor: pointer; position: relative; border-radius: 50%; }
.avatar-btn:hover .avatar { outline: 2px solid var(--border-strong); }
.premium-dot { position: absolute; inset-inline-end: -1px; bottom: -1px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--gold); border: 2px solid var(--bg); }

/* ---------------------------------------------------------------- buttons & forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding-inline: 20px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: transparent; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s;
  color: var(--text);
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-white { background: #fff; color: #0b1020; border-color: transparent; }
.btn-white:hover { background: #e7ebf7; color: #0b1020; }
.btn-glass { background: rgba(255, 255, 255, .14); color: #fff; border-color: transparent; backdrop-filter: blur(8px); }
.btn-glass:hover { background: rgba(255, 255, 255, .24); color: #fff; }
.btn-ghost { border-color: transparent; }
.btn-sm { height: 34px; padding-inline: 14px; font-size: .88rem; }
.btn-block { width: 100%; }
.btn.is-active { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.btn-gold { background: var(--gold); color: #2b1d00; border-color: transparent; }
.btn-gold:hover { filter: brightness(1.06); background: var(--gold); color: #2b1d00; }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .9rem; color: var(--text-2); }
.field input:not([type=checkbox]):not([type=file]):not([type=radio]), .field select, .field textarea, .input {
  width: 100%; height: 46px; padding-inline: 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg-2); outline: none; transition: border-color .15s, box-shadow .15s;
}
.field textarea, textarea.input { height: auto; min-height: 96px; padding-block: 10px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field input[type=file] { font-size: .9rem; color: var(--text-2); }
.errorlist { list-style: none; padding: 0; margin: 6px 0 0; color: var(--danger); font-size: .86rem; }
.helptext { color: var(--muted); font-size: .84rem; }
.code-input { text-align: center; letter-spacing: .5em; font-size: 1.4rem !important; font-weight: 700; }

/* ---------------------------------------------------------------- messages */
.messages { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 8px; }
.messages li { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border);
  border-inline-start: 3px solid var(--accent); color: var(--text-2); }
.messages .success { border-inline-start-color: var(--success); }
.messages .error { border-inline-start-color: var(--danger); }
.messages .warning { border-inline-start-color: var(--warning); }

/* ---------------------------------------------------------------- hero (home) */
.hero { position: relative; margin-top: -24px; margin-inline: calc(-1 * clamp(16px, 3.5vw, 64px)); margin-bottom: 28px;
  height: clamp(420px, 62vh, 680px); overflow: hidden; background: var(--bg-2); color: #fff; }
.hero-slide { position: absolute; inset: 0; opacity: 0; transition: opacity .8s ease; pointer-events: none; }
.hero-slide.active { opacity: 1; pointer-events: auto; }
.hero-slide .bg { position: absolute; inset: 0; background-size: cover; background-position: center 30%; transform: scale(1.03); }
.hero-slide.active .bg { animation: heroZoom 9s ease-out forwards; }
@keyframes heroZoom { from { transform: scale(1.08); } to { transform: scale(1.02); } }
.hero-slide::after { content: ""; position: absolute; inset: 0; background: var(--hero-side), var(--hero-overlay); }
.hero-content { position: absolute; z-index: 1; inset-inline-start: clamp(16px, 3.5vw, 64px); bottom: clamp(48px, 9vh, 96px);
  max-width: min(620px, 90%); }
.hero-eyebrow { display: inline-flex; gap: 8px; align-items: center; font-size: .82rem; font-weight: 600; color: rgba(255,255,255,.8); margin-bottom: 10px; }
.hero-eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--violet); }
.hero h1 { margin: 0 0 10px; font-size: clamp(1.9rem, 4.2vw, 3.4rem); line-height: 1.15; font-weight: 800; letter-spacing: -.02em;
  text-shadow: 0 2px 24px rgba(0, 0, 0, .4); }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: .9rem; color: rgba(255,255,255,.85); margin-bottom: 12px; }
.hero-meta .imdb { background: #f5c518; color: #000; font-weight: 800; padding: 1px 6px; border-radius: 4px; font-size: .78rem; }
.hero p { margin: 0 0 20px; color: rgba(255,255,255,.82); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; max-width: 560px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-actions .btn { height: 46px; padding-inline: 24px; }
.hero-dots { position: absolute; z-index: 2; bottom: 22px; inset-inline-end: clamp(16px, 3.5vw, 64px); display: flex; gap: 6px; }
.hero-dots button { width: 24px; height: 4px; border-radius: 4px; border: 0; background: rgba(255,255,255,.3); cursor: pointer; padding: 0; transition: width .3s, background .3s; }
.hero-dots button.active { width: 40px; background: #fff; }
.hero-empty { display: grid; place-items: center; height: 100%; text-align: center; padding: 20px;
  background: radial-gradient(ellipse at 30% 20%, rgba(91,140,255,.18), transparent 60%), radial-gradient(ellipse at 80% 90%, rgba(139,124,246,.14), transparent 55%), var(--bg-2); }
.hero-empty h1 { text-shadow: none; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 28px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips a { flex: none; padding: 7px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  font-size: .88rem; font-weight: 500; color: var(--text-2); transition: background .15s, color .15s, border-color .15s; }
.chips a:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }

/* ---------------------------------------------------------------- sections & rows */
.section { margin-bottom: 40px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.section-head h2 { margin: 0; font-size: 1.2rem; font-weight: 700; letter-spacing: -.01em; }
.section-head a { color: var(--muted); font-weight: 500; font-size: .88rem; transition: color .15s; }
.section-head a:hover { color: var(--accent-text); }

.row-scroll { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 175px); gap: 16px;
  overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x mandatory; scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
.row-scroll > * { scroll-snap-align: start; }
.row-scroll.wide { grid-auto-columns: minmax(250px, 290px); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 22px 16px; }

/* ---------------------------------------------------------------- cards */
.card { position: relative; display: block; }
.card-poster { position: relative; aspect-ratio: 2 / 3; border-radius: var(--radius); overflow: hidden; background: var(--surface);
  transition: transform .25s ease, box-shadow .25s ease; }
.card:hover .card-poster { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card-poster img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .card-poster img { transform: scale(1.04); }
.card-poster::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); pointer-events: none; }
.card-poster .placeholder { width: 100%; height: 100%; display: grid; place-items: center; padding: 12px; text-align: center;
  font-weight: 700; color: var(--text-2); background: linear-gradient(160deg, var(--surface-2), var(--surface)); }
.card-play { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transition: opacity .2s;
  background: linear-gradient(0deg, rgba(0,0,0,.55), rgba(0,0,0,.1)); }
.card-play span { width: 46px; height: 46px; border-radius: 50%; background: rgba(255,255,255,.92); color: #0b1020; display: grid; place-items: center; }
.card:hover .card-play { opacity: 1; }
.card-badges { position: absolute; top: 8px; inset-inline-start: 8px; display: flex; flex-wrap: wrap; gap: 4px; z-index: 1; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 5px; font-size: .72rem; font-weight: 700;
  background: rgba(11, 16, 32, .78); color: #fff; backdrop-filter: blur(6px); line-height: 1.5; }
.badge-free { background: rgba(16, 185, 129, .9); }
.badge-dub { background: rgba(11, 16, 32, .78); }
.badge-sub { background: rgba(11, 16, 32, .78); }
.badge-premium { background: var(--gold); color: #2b1d00; }
.card-rating { position: absolute; bottom: 8px; inset-inline-end: 8px; z-index: 1; }
.badge-imdb { background: #f5c518; color: #000; }
.card-title { margin: 10px 0 0; font-size: .93rem; font-weight: 600; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.progress-bar { height: 3px; background: rgba(255, 255, 255, .25); position: absolute; inset-inline: 0; bottom: 0; z-index: 1; }
.progress-bar span { display: block; height: 100%; background: var(--accent); }
.ep-card .card-poster { aspect-ratio: 16 / 9; }

/* ---------------------------------------------------------------- browse */
.browse { display: grid; grid-template-columns: 260px 1fr; gap: 28px; align-items: start; }
.filters { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px;
  position: sticky; top: calc(var(--header-h) + 16px); }
.filters h3 { margin: 0 0 14px; font-size: 1rem; }
.filters .field { margin-bottom: 12px; }
.filters .field select, .filters .field input { height: 40px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; margin-bottom: 12px; color: var(--text-2); }
.check input { accent-color: var(--accent); width: 17px; height: 17px; }
.seg { display: flex; background: var(--bg-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px; gap: 2px; }
.seg label { flex: 1; text-align: center; padding: 6px 4px; border-radius: 999px; cursor: pointer; font-size: .85rem; font-weight: 600; color: var(--muted); margin: 0; }
.seg input { display: none; }
.seg label:has(input:checked) { background: var(--surface-3); color: var(--text); }
.result-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); padding-inline: 10px; color: var(--text-2); }
.pagination a:hover { border-color: var(--border-strong); color: var(--text); }
.pagination .current { background: var(--accent); color: #fff; border-color: transparent; }
.empty { text-align: center; padding: 64px 16px; color: var(--muted); }
.empty .icon { width: 44px; height: 44px; opacity: .4; margin: 0 auto 10px; }

/* ---------------------------------------------------------------- detail */
.detail-hero { position: relative; margin-top: -24px; margin-inline: calc(-1 * clamp(16px, 3.5vw, 64px)); margin-bottom: 32px;
  min-height: clamp(440px, 58vh, 620px); color: #fff; display: flex; align-items: flex-end; overflow: hidden; background: var(--bg-2); }
.detail-hero .bg { position: absolute; inset: 0; background-size: cover; background-position: center 25%; }
.detail-hero .bg::after { content: ""; position: absolute; inset: 0; background: var(--hero-side), var(--hero-overlay); }
.detail-inner { position: relative; display: grid; grid-template-columns: 200px 1fr; gap: 32px; align-items: end;
  padding: 40px clamp(16px, 3.5vw, 64px) 36px; width: 100%; }
.detail-poster { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg); aspect-ratio: 2/3; background: rgba(255,255,255,.08); }
.detail-poster img { width: 100%; height: 100%; object-fit: cover; }
.detail-info h1 { margin: 0; font-size: clamp(1.7rem, 3.4vw, 2.8rem); line-height: 1.2; font-weight: 800; letter-spacing: -.02em; }
.detail-info .alt-title { color: rgba(255,255,255,.65); margin: 4px 0 14px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.meta-row .pill { padding: 3px 11px; border-radius: 999px; background: rgba(255, 255, 255, .1); font-size: .82rem; color: rgba(255,255,255,.9);
  border: 1px solid rgba(255,255,255,.08); }
.meta-row a.pill:hover { background: rgba(255, 255, 255, .2); }
.scores { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.score-box { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255,255,255,.08); border-radius: var(--radius-sm);
  padding: 7px 14px; display: flex; align-items: center; gap: 10px; backdrop-filter: blur(6px); }
.score-box .num { font-size: 1.3rem; font-weight: 800; }
.score-box small { display: block; color: rgba(255,255,255,.65); font-size: .74rem; line-height: 1.2; }
.imdb-logo { background: #f5c518; color: #000; font-weight: 900; padding: 2px 6px; border-radius: 4px; font-size: .8rem; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-hero .btn:not(.btn-primary):not(.btn-white) { background: rgba(255, 255, 255, .12); color: #fff; border-color: transparent; backdrop-filter: blur(8px); }
.detail-hero .btn:not(.btn-primary):not(.btn-white):hover { background: rgba(255, 255, 255, .22); }
.detail-hero .btn.is-active { background: #fff !important; color: #0b1020 !important; }
.synopsis { color: rgba(255,255,255,.82); max-width: 760px; margin: 16px 0 0; }

.layout-2 { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 24px; }
.panel > h2, .panel > h3 { margin-top: 0; font-size: 1.05rem; font-weight: 700; }
.promo { background: linear-gradient(150deg, var(--surface-2) 0%, var(--surface) 100%); position: relative; overflow: hidden; }
.promo::before { content: ""; position: absolute; width: 180px; height: 180px; border-radius: 50%; inset-inline-end: -60px; top: -60px;
  background: radial-gradient(circle, rgba(139,124,246,.25), transparent 70%); }
.promo p { color: var(--text-2); position: relative; }
.promo h3 { position: relative; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 14px; border: 0; background: none; cursor: pointer; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs .active { color: var(--text); border-bottom-color: var(--accent); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

.ep-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.ep-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg-2); transition: border-color .15s, background .15s; }
.ep-item:hover { border-color: var(--border-strong); background: var(--surface-2); }
.ep-item.current { border-color: var(--accent); background: var(--accent-soft); }
.ep-num { width: 36px; height: 36px; border-radius: 8px; background: var(--surface-3); color: var(--text); display: grid; place-items: center; font-weight: 700; flex: none; }
.ep-item.current .ep-num { background: var(--accent); color: #fff; }
.ep-item.locked { opacity: .7; }
.ep-item .ep-text { flex: 1; min-width: 0; }
.ep-item .ep-text b { display: block; font-size: .9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ep-item .ep-text small { color: var(--muted); }
.ep-item .watched { color: var(--success); }

.rating-stars { display: flex; gap: 1px; direction: ltr; flex-wrap: wrap; }
.rating-stars button { border: 0; background: none; cursor: pointer; padding: 2px; color: var(--surface-3); font-size: 1.4rem; line-height: 1; transition: color .1s; }
.rating-stars button.on { color: var(--gold); }
.rating-stars:hover button { color: var(--gold); }
.rating-stars button:hover ~ button { color: var(--surface-3); }

/* ---------------------------------------------------------------- watch */
.player-wrap { background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9; position: relative; box-shadow: var(--shadow-lg); }
.player-wrap video { width: 100%; height: 100%; }
.player-locked { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: #fff;
  background: radial-gradient(ellipse at center, rgba(27, 34, 64, .9), rgba(5, 8, 18, .98)); }
.player-locked .icon { width: 48px; height: 48px; margin: 0 auto 12px; opacity: .85; }
.player-locked h2 { margin: 0 0 6px; }
.player-locked p { color: rgba(255,255,255,.75); margin: 0 0 18px; }
.player-locked .btn { margin: 4px; }
.watch-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0; }
.watch-bar h1 { margin: 0; font-size: 1.3rem; }
.watch-bar h1 a:hover { color: var(--accent-text); }
.watch-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.download-list { display: grid; gap: 8px; }
.download-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-2); }
.download-item b { font-size: .93rem; font-weight: 600; }
.ep-side { max-height: 560px; overflow-y: auto; display: grid; gap: 8px; scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }

:root { --plyr-color-main: #3b6ef5; --plyr-font-family: var(--font); }
.plyr { height: 100%; }
.plyr__captions .plyr__caption { font-family: "Vazirmatn", var(--font); font-size: 1.15em; }

/* ---------------------------------------------------------------- comments */
.comment-form textarea { margin-bottom: 8px; }
.comment-form-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.comment { display: flex; gap: 12px; padding: 16px 0; border-top: 1px solid var(--border); }
.comment:first-of-type { border-top: 0; }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.comment-head b { font-size: .92rem; }
.comment-head .uid { font-size: .76rem; color: var(--muted); }
.comment-head time { font-size: .78rem; color: var(--muted); margin-inline-start: auto; }
.comment-text { white-space: pre-wrap; word-wrap: break-word; color: var(--text-2); }
.comment-text.spoiler { filter: blur(6px); cursor: pointer; user-select: none; transition: filter .2s; }
.comment-text.spoiler.revealed { filter: none; user-select: auto; }
.comment-actions { display: flex; gap: 6px; margin-top: 6px; align-items: center; flex-wrap: wrap; }
.vote-btn { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border); background: transparent; border-radius: 999px;
  padding: 3px 10px; cursor: pointer; font-size: .84rem; color: var(--muted); transition: color .15s, border-color .15s; }
.vote-btn:hover { color: var(--text); border-color: var(--border-strong); }
.vote-btn.on.up { color: var(--success); border-color: var(--success); }
.vote-btn.on.down { color: var(--danger); border-color: var(--danger); }
.link-btn { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: .84rem; padding: 3px 6px; }
.link-btn:hover { color: var(--accent-text); }
.replies { margin-top: 8px; padding-inline-start: 14px; border-inline-start: 2px solid var(--border); }
.replies .comment { padding: 10px 0; }
.reply-form { display: none; margin-top: 8px; }
.reply-form.open { display: block; }
.premium-tag { color: var(--gold); font-size: .7rem; font-weight: 700; border: 1px solid currentColor; padding: 0 6px; border-radius: 4px; }

/* ---------------------------------------------------------------- auth */
.auth-wrap { max-width: 440px; margin: 24px auto; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 30px; box-shadow: var(--shadow); }
.auth-card h1 { margin: 0 0 4px; font-size: 1.45rem; text-align: center; }
.auth-card .sub { text-align: center; color: var(--muted); margin: 0 0 22px; }
.auth-switch { text-align: center; margin-top: 18px; color: var(--muted); }
.auth-switch a { color: var(--accent-text); font-weight: 600; }
.seg-tabs { display: flex; background: var(--bg-2); border: 1px solid var(--border); border-radius: 999px; padding: 4px; margin-bottom: 22px; }
.seg-tabs button { flex: 1; border: 0; background: none; padding: 8px; border-radius: 999px; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg-tabs button.active { background: var(--surface-3); color: var(--text); }

/* ---------------------------------------------------------------- user panel */
.profile-head { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 24px 28px; display: flex; gap: 20px;
  align-items: center; flex-wrap: wrap; margin-bottom: 20px; position: relative; overflow: hidden; }
.profile-head::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--accent), var(--violet)); }
.profile-head h1 { margin: 0; font-size: 1.45rem; }
.profile-head .uid-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 2px 12px; font-size: .88rem; margin-top: 6px; color: var(--text-2); }
.profile-head p { color: var(--text-2); }
.profile-head .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat .num { font-size: 1.5rem; font-weight: 800; }
.stat .label { color: var(--muted); font-size: .85rem; }
.sub-box { border-radius: var(--radius); padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 20px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); }
.sub-box b { color: var(--text); }
.sub-box.premium { border-color: rgba(245, 196, 81, .4); background: linear-gradient(90deg, rgba(245, 196, 81, .1), var(--surface) 60%); }
.avatar-edit { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }

/* ---------------------------------------------------------------- plans */
.plans-head { text-align: center; margin: 12px 0 32px; }
.plans-head h1 { margin: 0 0 6px; font-size: clamp(1.6rem, 3vw, 2.2rem); }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; max-width: 980px; margin-inline: auto; }
.plan { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 28px; text-align: center; position: relative; }
.plan.hl { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-lg); }
.plan .ribbon { position: absolute; top: -12px; inset-inline-start: 50%; transform: translateX(-50%); background: var(--accent); color: #fff;
  padding: 3px 14px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
[dir="rtl"] .plan .ribbon { transform: translateX(50%); }
.plan h2 { font-size: 1.1rem; }
.plan .price { font-size: 2.1rem; font-weight: 800; margin: 10px 0 0; letter-spacing: -.02em; }
.plan .per { color: var(--muted); font-size: .86rem; margin-bottom: 20px; }
.features { list-style: none; padding: 0; margin: 32px auto 0; max-width: 680px; display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); color: var(--text-2); }
.features li { display: flex; gap: 10px; align-items: center; }
.features .icon { color: var(--success); }

/* ---------------------------------------------------------------- footer */
.site-footer { border-top: 1px solid var(--border); padding: 28px 0; color: var(--muted); font-size: .88rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer-inner nav { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-inner a:hover { color: var(--text); }

/* ---------------------------------------------------------------- mobile */
.bottom-nav { display: none; }

@media (max-width: 1024px) {
  .browse, .layout-2 { grid-template-columns: 1fr; }
  .filters { position: static; }
  .main-nav { display: none; }
}
@media (max-width: 720px) {
  :root { --header-h: 58px; }
  .header-search { display: none; }
  .header-actions { margin-inline-start: auto; }
  .hero { height: 70vh; min-height: 440px; }
  .hero-content { bottom: 56px; }
  .hero p { -webkit-line-clamp: 2; }
  .detail-inner { grid-template-columns: 1fr; padding-top: 120px; }
  .detail-poster { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 18px 12px; }
  .row-scroll { grid-auto-columns: 128px; gap: 12px; }
  .row-scroll.wide { grid-auto-columns: 230px; }
  main { padding-bottom: 92px; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; inset-inline: 0; z-index: 50; background: var(--header-bg);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .7rem; color: var(--muted); padding: 4px; }
  .bottom-nav a.active { color: var(--text); }
  .bottom-nav .icon { width: 22px; height: 22px; }
  .site-footer { padding-bottom: 96px; }
}
