/* beta.orx.ma — PREMIUM cinematic design (Netflix-style rows, dark, RTL)
   Concept: home = cinematic hero + rows by category; watch = 16:9 player,
   info UNDER the player, no reels scroll. */
:root {
    --bg: #07070d;
    --bg2: #0e0e18;
    --card: #151522;
    --card2: #1c1c30;
    --text: #f5f5fa;
    --muted: #a2a2b8;
    --accent: #7c3aed;
    --accent2: #c084fc;
    --gold: #f5c518;
    --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", "Noto Sans Arabic", Tahoma, Arial, sans-serif;
    direction: rtl;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; }

/* ---- Top nav (glass) ---- */
header.topbar {
    position: fixed; top: 0; right: 0; left: 0; z-index: 100;
    display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
    padding: 14px 28px;
    background: linear-gradient(180deg, rgba(7,7,13,.95), rgba(7,7,13,.75) 70%, transparent);
    transition: background .25s ease;
}
header.topbar.scrolled { background: rgba(7,7,13,.96); border-bottom: 1px solid #1e1e32; }
.logo { font-size: 24px; font-weight: 900; letter-spacing: 1px; }
/* Header logo image (the user's own ORX STREAM logo, assets/logo.png,
   2048x682 — 3:1). Height 40px desktop / 32px phone, width auto, so the
   header layout (logo left, menu right, search centred) is unchanged. */
.logo-img { height: 60px; width: auto; display: block; }
.logo b { color: var(--accent2); }
/* Hamburger menu: the nav links live behind a menu button on ALL screen sizes
   (desktop too, not just phones) — the button toggles .menu-open on the header. */
header.topbar .menu-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid #2b2b48; border-radius: 12px; background: var(--bg2); color: var(--text); font-size: 22px; cursor: pointer; flex: 0 0 auto; }
/* Search toggle (show/hide the page search bar): same look as the menu
   button, sits next to it on the right. Order 2 = between menu (1) and logo (3). */
header.topbar .search-toggle { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid #2b2b48; border-radius: 12px; background: var(--bg2); color: var(--text); font-size: 20px; cursor: pointer; flex: 0 0 auto; order: 2; }
/* Header layout: logo on the LEFT on all devices, menu button on the right,
   search centered. In RTL flex, order 1 = rightmost, higher = further left.
   The logo needs margin-inline-start:auto (right side in RTL) to stay at
   the far left now that the searchbox (which used to push it left with its
   auto margins) is out of the header. */
header.topbar .logo { order: 3; margin-inline-start: auto; }
header.topbar .menu-btn { order: 1; }
header.topbar .searchbox { order: 2; }
nav.mainnav { order: 4; }
nav.mainnav { display: none; }
header.topbar.menu-open nav.mainnav { display: flex; flex-direction: column; flex-basis: 100%; gap: 0; overflow: visible; padding-bottom: 4px; }
header.topbar.menu-open nav.mainnav a { padding: 12px 4px; border-bottom: 1px solid #1e1e32; font-size: 16px; white-space: normal; }
header.topbar.menu-open nav.mainnav a:last-child { border-bottom: 0; }
nav.mainnav a { color: #d5d5e5; font-size: 15px; font-weight: 600; padding: 6px 2px; border-bottom: 2px solid transparent; }
nav.mainnav a:hover { color: #fff; }
nav.mainnav a.active { color: #fff; border-bottom-color: var(--accent); }
.searchbox { margin-inline: auto; display: flex; gap: 8px; }
.searchbox input {
    background: rgba(20,20,35,.85); color: var(--text);
    border: 1px solid #2b2b48; border-radius: 999px;
    padding: 9px 16px; width: 230px; font-size: 14px; outline: none;
}
.searchbox input:focus { border-color: var(--accent); }
.searchbox button {
    background: var(--accent); color: #fff; border: 0; border-radius: 999px;
    padding: 9px 18px; cursor: pointer; font-size: 14px; font-weight: 700;
}
.searchbox button:hover { background: #8b5cf6; }

/* ---- Page search (in the page, not the header) ---- */
.page-search { max-width: 760px; margin: 18px auto 4px; padding: 0 16px; }
.page-search .searchbox { width: 100%; margin: 0; }
.page-search .searchbox input { flex: 1 1 auto; width: auto; min-width: 0; font-size: 15px; padding: 12px 18px; }
.page-search .searchbox button { padding: 12px 22px; font-size: 15px; }

/* ---- Icon system (.ic) ---- */
/* One professional line-icon set (lib/icons.php): 24x24, stroke 2, round
   caps, currentColor. .ic sizes every icon uniformly to the surrounding
   text and aligns it on the baseline; .ic-lg is for large decorative icons. */
.ic { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; }
.ic-lg { width: 2.6em; height: 2.6em; vertical-align: -0.2em; flex: none; }
button .ic, a .ic { pointer-events: none; }

/* ---- Hero ---- */
.hero {
    position: relative; min-height: 78vh;
    display: flex; align-items: flex-end;
    padding: 120px 28px 48px;
    background-size: cover; background-position: center 20%;
    overflow: hidden;
}
.hero::before {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(7,7,13,.55) 0%, rgba(7,7,13,.15) 35%, rgba(7,7,13,.92) 78%, var(--bg) 100%);
}
.hero::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, rgba(7,7,13,.85) 0%, rgba(7,7,13,.25) 55%, transparent 100%);
}
.hero-inner { position: relative; z-index: 2; max-width: 640px; }
.hero .kicker {
    display: inline-block; font-size: 13px; font-weight: 700; letter-spacing: 2px;
    color: var(--accent2); margin-bottom: 10px;
}
.hero h1 { font-size: clamp(30px, 5vw, 52px); line-height: 1.15; font-weight: 900; margin-bottom: 12px; text-shadow: 0 2px 24px rgba(0,0,0,.6); }
.hero .meta { display: flex; gap: 14px; color: #d5d5e5; font-size: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.hero .meta .year { color: var(--gold); font-weight: 700; }
.hero p.desc { color: #cfcfe0; line-height: 1.8; font-size: 15px; margin-bottom: 20px;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero .actions { display: flex; gap: 12px; }
.btn-play {
    background: #fff; color: #111; font-weight: 800; font-size: 16px;
    padding: 12px 28px; border-radius: 999px; display: inline-flex; gap: 8px; align-items: center;
}
.btn-play:hover { background: #e5e5f0; }
.btn-ghost {
    background: rgba(255,255,255,.14); color: #fff; font-weight: 700; font-size: 15px;
    padding: 12px 22px; border-radius: 999px; border: 1px solid rgba(255,255,255,.25);
}
.btn-ghost:hover { background: rgba(255,255,255,.24); }

/* ---- Layout ---- */
main { max-width: 1360px; margin: 0 auto; padding: 8px 28px 20px; }
main.pad-top { padding-top: 96px; }
.section { margin: 34px 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.section-head h2 { font-size: 22px; font-weight: 800; }
.section-head a { font-size: 14px; color: var(--accent2); }
.section-head a:hover { text-decoration: underline; }

/* ---- Rows (Netflix style) ---- */
.cards {
    display: flex; gap: 14px; overflow-x: auto; padding: 6px 2px 12px;
    scroll-snap-type: x mandatory; scrollbar-width: thin;
}
.cards::-webkit-scrollbar { height: 6px; }
.cards::-webkit-scrollbar-thumb { background: #2b2b48; border-radius: 3px; }
.card {
    flex: 0 0 172px; scroll-snap-align: start;
    border-radius: var(--radius); overflow: hidden; background: var(--card);
    transition: transform .18s ease, box-shadow .18s ease;
    position: relative;
}
.card:hover { transform: translateY(-6px) scale(1.03); box-shadow: 0 14px 34px rgba(0,0,0,.55), 0 0 0 1px rgba(192,132,252,.35); z-index: 3; }
.card .poster { position: relative; }
.card img { width: 100%; height: 248px; object-fit: cover; background: #23233a; }
.card .poster::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,.75));
}
.card .play-badge {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%) scale(.8);
    width: 52px; height: 52px; border-radius: 50%;
    background: rgba(124,58,237,.92); color: #fff; font-size: 20px;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity .18s ease, transform .18s ease; z-index: 2;
}
.card:hover .play-badge { opacity: 1; transform: translate(-50%,-50%) scale(1); }
.card .t { padding: 10px 12px 4px; font-size: 14px; font-weight: 700; line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 46px; }
.card .meta { padding: 0 12px 12px; color: var(--muted); font-size: 12px; display: flex; gap: 8px; align-items: center; }
.badge-q {
    background: rgba(124,58,237,.22); color: var(--accent2);
    border: 1px solid rgba(192,132,252,.4); border-radius: 6px;
    padding: 1px 7px; font-size: 11px; font-weight: 700;
}
/* "جديد" badge on followed-series cards (#17): a series gained episodes
   since the user followed it. */
.badge-new {
    background: var(--accent); color: #fff;
    border-radius: 6px; padding: 1px 7px; font-size: 11px; font-weight: 700;
}
/* View count on cards (#19): eye icon + compact number, muted. */
.card .meta .views { display: inline-flex; align-items: center; gap: 3px; }
/* Hover description (#32, desktop only): overview overlay on the poster.
   Fades in on hover; clamped to ~4 lines; sits above the poster gradient
   (z-index 3) and never blocks clicks (pointer-events: none). */
.card .poster .card-ov {
    position: absolute; inset: 0; z-index: 3;
    display: flex; align-items: flex-end;
    padding: 12px;
    background: linear-gradient(180deg, rgba(0,0,0,0) 20%, rgba(0,0,0,.85));
    color: #fff; font-size: 12.5px; line-height: 1.55; text-align: right;
    opacity: 0; transition: opacity .2s ease; pointer-events: none;
    overflow: hidden;
}
.card .poster .card-ov span {
    display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
@media (hover: hover) {
    .card:hover .poster .card-ov { opacity: 1; }
}
/* Continue Watching progress bar (#4): thin bar on the poster bottom
   of client-rendered cards that carry a saved position. */
.cw-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255,255,255,.25); z-index: 3; }
.cw-progress i { display: block; height: 100%; background: var(--accent); }

/* ---- Grids & chips ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 16px; }
.grid .card { flex: none; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 22px; }
.chip {
    background: var(--bg2); border: 1px solid #2b2b48; border-radius: 999px;
    padding: 8px 18px; font-size: 14px; color: var(--text); cursor: pointer; font-weight: 600;
}
.chip.active, .chip:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-count { opacity: .65; font-size: 12px; font-weight: 400; }
.genre-tag {
    background: #23233a; border: 1px solid #2b2b48; border-radius: 999px;
    padding: 2px 10px; font-size: 12px; color: var(--muted); font-weight: 600;
}

/* ---- Watch page: 16:9 player, info UNDER player, no reels scroll ---- */
.player-wrap {
    position: relative; width: min(100%, calc(78vh * 16 / 9)); aspect-ratio: 16 / 9; margin: 0 auto;
    background: #000; border-radius: 16px; overflow: hidden; margin-bottom: 18px;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.player-wrap iframe, .player-wrap video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; object-fit: contain; }
.direct-note { color: var(--muted); font-size: 13px; margin: -8px 0 20px; }
.servers { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; align-items: center; }
.servers .lbl { color: var(--muted); font-size: 14px; margin-inline-end: 4px; }
.server-btn {
    background: var(--bg2); border: 1px solid #2b2b48; border-radius: 999px;
    padding: 9px 18px; font-size: 14px; cursor: pointer; color: var(--text); font-weight: 600;
}
.server-btn.active, .server-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.info { background: var(--bg2); border: 1px solid #1e1e32; border-radius: 16px; padding: 24px; }
.info h1 { font-size: 26px; margin-bottom: 12px; }
.info .meta { color: var(--muted); font-size: 14px; margin-bottom: 14px; display: flex; gap: 18px; flex-wrap: wrap; }
.info .meta .year { color: var(--gold); font-weight: 700; }
.info p { color: #cfcfe0; line-height: 1.9; }
.dl-list { margin-top: 18px; display: flex; gap: 8px; flex-wrap: wrap; }
.dl-list a {
    background: var(--card); border: 1px solid #2b2b48; border-radius: 999px;
    padding: 9px 16px; font-size: 13px; font-weight: 600;
}
.dl-list a:hover { border-color: var(--accent2); color: var(--accent2); }

footer { text-align: center; color: var(--muted); font-size: 13px; padding: 32px 16px; border-top: 1px solid #1e1e32; margin-top: 36px; }
.empty { color: var(--muted); text-align: center; padding: 48px 0; }
.page-title { font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: 14px; margin-bottom: 8px; }

/* ---- Top 10 (big rank numbers) ---- */
.top10 { display: flex; gap: 16px; overflow-x: auto; padding: 6px 2px 12px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.top10::-webkit-scrollbar { height: 6px; }
.top10::-webkit-scrollbar-thumb { background: #2b2b48; border-radius: 3px; }
.top10-item { flex: 0 0 190px; scroll-snap-align: start; position: relative; display: flex; align-items: flex-end; }
.top10-item .rank {
    font-size: 110px; font-weight: 900; line-height: .8; color: transparent;
    -webkit-text-stroke: 2px var(--accent2); margin-inline-end: -14px; z-index: 1;
    text-shadow: 0 0 24px rgba(124,58,237,.35); flex: 0 0 auto;
}
.top10-item .poster { position: relative; flex: 1; border-radius: var(--radius); overflow: hidden; background: var(--card); }
.top10-item img { width: 100%; height: 248px; object-fit: cover; background: #23233a; }
.top10-item .poster::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,.75)); }
.top10-item .play-badge {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%) scale(.8);
    width: 52px; height: 52px; border-radius: 50%; background: rgba(124,58,237,.92); color: #fff; font-size: 20px;
    display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .18s ease, transform .18s ease; z-index: 2;
}
.top10-item:hover .play-badge { opacity: 1; transform: translate(-50%,-50%) scale(1); }
.top10-item .t { position: absolute; bottom: 0; right: 0; left: 0; padding: 10px 12px 6px; font-size: 14px; font-weight: 700; line-height: 1.5; z-index: 2;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.top10-item .meta { position: absolute; bottom: -20px; right: 0; color: var(--muted); font-size: 12px; }

/* ---- Live search suggestions ---- */
.searchbox { position: relative; }
.suggest {
    position: absolute; top: calc(100% + 8px); inset-inline-start: 0; width: 320px; max-width: 90vw;
    background: #12121f; border: 1px solid #2b2b48; border-radius: 12px; overflow: hidden;
    box-shadow: 0 18px 44px rgba(0,0,0,.6); z-index: 200;
}
.suggest-item { display: flex; justify-content: space-between; gap: 10px; padding: 10px 14px; font-size: 14px; }
.suggest-item:hover { background: rgba(124,58,237,.18); }
.suggest-item .suggest-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-item .suggest-k { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ---- Watch page: actions, rating, downloads ---- */
.watch-actions { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.btn-list {
    background: rgba(124,58,237,.18); border: 1px solid rgba(192,132,252,.5); color: var(--accent2);
    border-radius: 999px; padding: 10px 22px; font-size: 14px; font-weight: 700; cursor: pointer;
}
.btn-list:hover { background: rgba(124,58,237,.32); }
.btn-list.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.rating { display: flex; align-items: center; gap: 8px; }
.rating-label { color: var(--muted); font-size: 14px; }
.stars { display: flex; gap: 2px; }
.star { background: none; border: 0; color: #3a3a58; font-size: 22px; cursor: pointer; padding: 0 2px; line-height: 1; }
.star:hover, .star.on { color: var(--gold); }
.rating-avg { color: var(--muted); font-size: 13px; }
.dl-section { margin-top: 20px; }
.dl-section h3 { font-size: 16px; margin-bottom: 10px; }

/* ---- Series progress ---- */
.series-progress { display: flex; gap: 14px; flex-wrap: wrap; margin: 24px 0; }
.progress-card {
    background: var(--bg2); border: 1px solid #1e1e32; border-radius: 16px;
    padding: 22px 28px; text-align: center; flex: 1; min-width: 180px;
}
.progress-card .big-num { display: block; font-size: 34px; font-weight: 900; color: var(--accent2); margin-bottom: 6px; }
.progress-card .lbl { color: var(--muted); font-size: 14px; }

/* ---- Anime watch page ---- */
.anime-head { display: flex; gap: 20px; align-items: flex-start; }
.anime-poster { width: 120px; height: 170px; object-fit: cover; border-radius: 12px; background: #23233a; flex: 0 0 auto; }
.anime-head h1 { font-size: 24px; margin-bottom: 10px; }
.ep-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.ep-btn {
    background: var(--bg2); border: 1px solid #2b2b48; border-radius: 10px;
    min-width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 700; color: var(--text); padding: 0 12px;
}
.ep-btn:hover { border-color: var(--accent2); color: var(--accent2); }
.ep-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

@media (max-width: 720px) {
    /* Mobile: the fixed header is taller than the 96px pad-top (nav wraps to
       4 rows), so it covered the player — only ~25% showed. Make the header
       static on mobile so it flows normally and never overlaps content. */
    header.topbar { position: static; padding: 12px 16px; gap: 10px; flex-wrap: wrap; }
    /* Mobile header logo: 32px tall so it fits the one-line header. */
    .logo-img { height: 48px; }
    main.pad-top { padding-top: 12px; }
    .hero { min-height: 64vh; padding: 24px 16px 36px; }
    main { padding: 8px 16px 20px; }
    .card { flex-basis: 148px; }
    .card img { height: 214px; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; }
    /* Poster in the info section: narrow portrait next to the text. */
    .tmdb-block { gap: 12px; }
    .tmdb-poster { width: 104px; }
    .info { padding: 16px; }
    .info h1 { font-size: 20px; }
}

/* ---- Theme toggle button ---- */
.theme-toggle {
    background: var(--bg2); border: 1px solid #2b2b48; color: var(--text);
    border-radius: 999px; width: 40px; height: 40px; font-size: 18px; line-height: 1;
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 auto; padding: 0;
}
.theme-toggle:hover { border-color: var(--accent2); }

/* ---- Filter row (year / quality selects + clear) ---- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 4px 0 18px; }
.filters select {
    background: var(--bg2); color: var(--text); border: 1px solid #2b2b48;
    border-radius: 999px; padding: 9px 14px; font-size: 14px; font-weight: 600;
    outline: none; cursor: pointer; font-family: inherit;
}
.filters select:focus { border-color: var(--accent); }
.filters .clear-filters { font-size: 14px; color: var(--accent2); font-weight: 700; }
.filters .clear-filters:hover { text-decoration: underline; }
.filters-label { color: var(--muted); font-size: 14px; font-weight: 700; }

/* ---- Light theme (dark stays the default) ----
   Applied via html.light (set in <head> before paint) and mirrored to
   body.light. Variables cascade; the rules below override the few
   hardcoded dark surfaces (topbar, borders, inputs, suggestion box). */
html.light, body.light {
    --bg: #f3f3f8;
    --bg2: #ffffff;
    --card: #ffffff;
    --card2: #ececf4;
    --text: #191926;
    --muted: #5c5c70;
    --accent: #6d28d9;
    --accent2: #7c3aed;
    --gold: #b45309;
}
html.light body, body.light { background: var(--bg); color: var(--text); }
html.light header.topbar, body.light header.topbar {
    background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,255,255,.78) 70%, transparent);
}
html.light header.topbar.scrolled, body.light header.topbar.scrolled {
    background: rgba(255,255,255,.96); border-bottom-color: #e3e3ee;
}
html.light nav.mainnav a, body.light nav.mainnav a { color: #4a4a60; }
html.light nav.mainnav a:hover, body.light nav.mainnav a:hover,
html.light nav.mainnav a.active, body.light nav.mainnav a.active { color: #191926; }
html.light .searchbox input, body.light .searchbox input {
    background: rgba(255,255,255,.92); color: var(--text); border-color: #d8d8e6;
}
html.light .chip, body.light .chip,
html.light .server-btn, body.light .server-btn,
html.light .ep-btn, body.light .ep-btn,
html.light .dl-list a, body.light .dl-list a,
html.light .filters select, body.light .filters select { border-color: #d8d8e6; }
html.light .genre-tag, body.light .genre-tag { background: #ececf4; border-color: #d8d8e6; }
html.light .info, body.light .info,
html.light .progress-card, body.light .progress-card { border-color: #e2e2ec; }
html.light footer, body.light footer { border-top-color: #e2e2ec; }
html.light .suggest, body.light .suggest { background: #fff; border-color: #d8d8e6; box-shadow: 0 18px 44px rgba(0,0,0,.18); }
html.light .card img, body.light .card img,
html.light .top10-item img, body.light .top10-item img,
html.light .anime-poster, body.light .anime-poster { background: #e8e8f0; }
html.light .star, body.light .star { color: #c9c9d8; }
html.light .info p, body.light .info p { color: #33334a; }
html.light .btn-ghost, body.light .btn-ghost {
    background: rgba(0,0,0,.06); color: #191926; border-color: rgba(0,0,0,.18);
}
html.light .btn-ghost:hover, body.light .btn-ghost:hover { background: rgba(0,0,0,.12); }
html.light .btn-play, body.light .btn-play { border: 1px solid #d8d8e6; }
html.light .theme-toggle, body.light .theme-toggle { border-color: #d8d8e6; }
html.light .card:hover, body.light .card:hover { box-shadow: 0 14px 34px rgba(0,0,0,.18), 0 0 0 1px rgba(124,58,237,.35); }

/* TMDB block (watch page) */
.tmdb-block { margin: 14px 0; }
.tmdb-block { display: flex; gap: 16px; align-items: flex-start; }
.tmdb-poster { width: 140px; flex: 0 0 auto; aspect-ratio: 2 / 3; object-fit: cover; border-radius: var(--radius); background: #23233a; }
.tmdb-text { flex: 1; min-width: 0; }
.tmdb-meta { margin-bottom: 8px; }
.tmdb-meta { display: flex; gap: 14px; margin: 10px 0 6px; color: var(--accent2); font-weight: 700; font-size: 14px; }
.tmdb-overview { color: var(--muted); font-size: 14px; line-height: 1.7; margin: 0; }

/* Player controls: quality / speed / PiP / Cast */
.ctl-note { color: var(--gold); font-size: 13px; margin: 6px 0 0; }
.ctl-note[hidden] { display: none; }
.switch-note { color: var(--accent2); font-size: 13px; margin: 6px 0 0; }
.switch-note[hidden] { display: none; }
.tmdb-meta .sep { color: var(--muted); }

/* ---- Custom video player — YouTube-like (own player, proxy URL) ---- */
.player-shell { position: relative; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.player-shell .player-wrap { margin-bottom: 0; box-shadow: none; }
/* Bottom bar: play | seek | time | fullscreen — one row, full width.
   direction:ltr forces the visual order play-LEFT / fullscreen-RIGHT:
   the page is RTL, so without it the flex row renders play on the right
   and fullscreen on the left. Seekbar internals use physical `right`
   positioning + physical pointer coordinates, so they are unaffected. */
.vp-bar {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
    display: flex; align-items: center; gap: 4px; direction: ltr;
    padding: 6px 8px 8px;
    background: linear-gradient(180deg, transparent, rgba(0,0,0,.85) 45%);
    transition: opacity .3s ease;
}
/* ---- Real fullscreen: the player fills the whole screen ----
   Without this, .player-wrap keeps width min(100%, 78vh*16/9) + 16:9
   aspect-ratio inside the fullscreen shell, so the video stays a small
   box instead of filling the screen (phone and desktop). */
.player-shell:fullscreen,
.player-shell:-webkit-full-screen {
    width: 100%; height: 100%;
    border-radius: 0; box-shadow: none; background: #000;
}
.player-shell:fullscreen .player-wrap,
.player-shell:-webkit-full-screen .player-wrap {
    width: 100%; height: 100%; max-height: none; aspect-ratio: auto;
    border-radius: 0; box-shadow: none; margin: 0;
}
.player-shell:fullscreen .player-wrap video,
.player-shell:fullscreen .player-wrap iframe,
.player-shell:-webkit-full-screen .player-wrap video,
.player-shell:-webkit-full-screen .player-wrap iframe {
    width: 100%; height: 100%; object-fit: contain;
}
.player-shell.vp-idle .vp-bar { opacity: 0; pointer-events: none; }
.player-shell.vp-idle .vp-center { opacity: 0; pointer-events: none; }
.player-shell.vp-idle .vp-more { opacity: 0; pointer-events: none; }
/* Seekbar: flexible, thin track that thickens on hover/drag (YouTube). */
.vp-seek {
    position: relative; flex: 1 1 auto; min-width: 0; height: 22px; cursor: pointer;
    display: flex; align-items: center; touch-action: none;
}
.vp-seek::before {
    content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 4px;
    transform: translateY(-50%); background: rgba(255,255,255,.3); border-radius: 4px;
    transition: height .15s ease;
}
.vp-seek:hover::before, .vp-seek.vp-drag::before { height: 6px; }
.vp-seek-buffered { position: absolute; top: 50%; left: 0; height: 4px; transform: translateY(-50%); background: rgba(255,255,255,.5); border-radius: 4px; }
.vp-seek-played { position: absolute; top: 50%; left: 0; height: 4px; transform: translateY(-50%); background: var(--accent); border-radius: 4px; }
.vp-seek:hover .vp-seek-buffered, .vp-seek.vp-drag .vp-seek-buffered,
.vp-seek:hover .vp-seek-played, .vp-seek.vp-drag .vp-seek-played { height: 6px; }
.vp-seek-handle {
    position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%;
    background: var(--accent); box-shadow: 0 1px 8px rgba(0,0,0,.7); transform: translate(-50%, -50%);
    opacity: 0; transition: opacity .15s ease;
}
.vp-seek:hover .vp-seek-handle, .vp-seek.vp-drag .vp-seek-handle { opacity: 1; }
.vp-seek-tip {
    position: absolute; bottom: 24px; transform: translateX(-50%);
    background: rgba(0,0,0,.92); color: #fff; font-size: 12px; padding: 6px;
    border-radius: 8px; white-space: nowrap; display: none; pointer-events: none;
    text-align: center; box-shadow: 0 4px 16px rgba(0,0,0,.5); z-index: 6;
}
.vp-seek-thumb { display: block; width: 160px; height: 90px; border-radius: 4px; background: #1a1a2e; object-fit: cover; }
.vp-seek-thumb.loading { opacity: .35; }
.vp-seek-tip-time { display: block; margin-top: 4px; font-weight: 700; }
.vp-seek:hover .vp-seek-tip, .vp-seek.vp-drag .vp-seek-tip { display: block; }
/* Bar buttons: clean SVG icons, no background box (YouTube). */
.vp-btn {
    flex: 0 0 auto; width: 40px; height: 40px; padding: 8px;
    background: transparent; color: #fff; border: 0; border-radius: 50%;
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    transition: background .15s ease, transform .1s ease;
}
.vp-btn:hover { background: rgba(255,255,255,.18); }
.vp-btn:active { transform: scale(.92); }
.vp-btn svg { width: 24px; height: 24px; fill: currentColor; }
.vp-time { color: #fff; font-size: 12px; font-weight: 500; white-space: nowrap; padding: 0 4px; flex: 0 0 auto; }
/* Center cluster: -10s, big play/pause, +10s. */
.vp-center {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    display: flex; align-items: center; gap: 36px; z-index: 5; direction: ltr;
    transition: opacity .3s ease;
}
.vp-center-play {
    width: 96px; height: 96px; border-radius: 50%;
    background: rgba(0,0,0,.55); color: #fff; border: 0;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background .15s ease, transform .15s ease;
}
.vp-center-play:hover { background: rgba(0,0,0,.75); transform: scale(1.06); }
.vp-center-play svg { width: 48px; height: 48px; fill: currentColor; }
.vp-skip {
    width: 72px; height: 72px; border-radius: 50%; position: relative;
    background: rgba(0,0,0,.45); color: #fff; border: 0;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background .15s ease, transform .15s ease;
}
.vp-skip:hover { background: rgba(0,0,0,.7); transform: scale(1.06); }
.vp-skip svg { width: 44px; height: 44px; fill: currentColor; }
.vp-skip span { position: absolute; font-size: 12px; font-weight: 700; color: #fff; }
.vp-spinner {
    position: absolute; top: 50%; left: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px;
    border: 4px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%;
    animation: vp-spin 1s linear infinite; z-index: 5;
}
.vp-spinner[hidden] { display: none; }
@keyframes vp-spin { to { transform: rotate(360deg); } }
/* Double-tap seek feedback (#3): brief +10 / −10 flash on the tapped half.
   Created in #player-shell by player.js (survives video rebuilds). */
.vp-dtap {
    position: absolute; top: 0; bottom: 0; width: 50%; z-index: 4;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none; opacity: 0;
    transition: opacity .18s ease;
}
.vp-dtap-left { left: 0; }
.vp-dtap-right { right: 0; }
.vp-dtap span {
    width: 64px; height: 64px; border-radius: 50%;
    background: rgba(0,0,0,.55); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 700; transform: scale(.8);
    transition: transform .18s ease;
}
.vp-dtap.show { opacity: 1; }
.vp-dtap.show span { transform: scale(1); }
/* Top-right 3-dots menu. */
.vp-more {
    position: absolute; top: 10px; inset-inline-end: 10px; z-index: 7;
    width: 40px; height: 40px; border-radius: 50%; border: 0;
    background: rgba(0,0,0,.45); color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s ease;
}
.vp-more:hover { background: rgba(0,0,0,.7); }
.vp-more svg { width: 22px; height: 22px; fill: currentColor; }
.vp-more-menu {
    position: absolute; top: 56px; inset-inline-end: 10px; z-index: 8;
    background: rgba(20,20,32,.96); border: 1px solid rgba(255,255,255,.14); border-radius: 14px;
    padding: 10px; min-width: 230px; max-width: calc(100% - 20px);
    box-shadow: 0 12px 32px rgba(0,0,0,.6);
}
.vp-more-menu[hidden] { display: none; }
.vp-mm-sec { padding: 4px 0 8px; }
.vp-mm-sec + .vp-mm-sec { border-top: 1px solid rgba(255,255,255,.1); padding-top: 10px; }
.vp-mm-label { color: #aaa; font-size: 12px; font-weight: 700; padding: 0 6px 6px; }
.vp-mm-row { display: flex; flex-wrap: wrap; gap: 6px; }
.vp-mm-row button {
    padding: 8px 12px; min-height: 38px; background: rgba(255,255,255,.08);
    color: var(--text); border: 0; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.vp-mm-row button:hover { background: rgba(255,255,255,.16); }
.vp-mm-row button.active { background: var(--accent); color: #fff; }
.vp-mm-item {
    display: block; width: 100%; text-align: right; padding: 11px 12px; min-height: 44px;
    background: transparent; color: var(--text); border: 0; border-radius: 8px;
    font-size: 14px; font-weight: 600; cursor: pointer;
}
.vp-mm-item:hover { background: rgba(255,255,255,.1); }
.vp-mm-item.active { background: var(--accent); color: #fff; }

/* ---- Player on phones: keep the bar to 2 rows (seek + one button row) ---- */
@media (max-width: 640px) {
    .player-wrap { border-radius: 12px; }
    .vp-bar { gap: 2px; padding: 4px 6px 6px; }
    .vp-btn { width: 36px; height: 36px; padding: 6px; }
    .vp-btn svg { width: 22px; height: 22px; }
    .vp-time { font-size: 11px; }
    .vp-center { gap: 24px; }
    .vp-center-play { width: 76px; height: 76px; }
    .vp-center-play svg { width: 38px; height: 38px; }
    .vp-skip { width: 56px; height: 56px; }
    .vp-skip svg { width: 34px; height: 34px; }
    .vp-more { width: 36px; height: 36px; top: 8px; inset-inline-end: 8px; }
    .vp-more-menu { top: 50px; min-width: 200px; }
}

/* ---- Download quality popup ---- */
.dl-modal { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.dl-modal[hidden] { display: none; }
.dl-box { position: relative; width: min(420px, 100%); background: #14141f; border: 1px solid rgba(255,255,255,.14); border-radius: 16px; padding: 22px 18px 18px; }
.dl-box h3 { font-size: 18px; margin-bottom: 4px; }
.dl-sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.dl-close { position: absolute; top: 10px; left: 10px; background: #e50914; color: #fff; border: 0; border-radius: 50%; width: 34px; height: 34px; font-size: 15px; cursor: pointer; }
.dl-q-btn {
    display: block; width: 100%; text-align: center; padding: 14px; min-height: 52px;
    margin-top: 10px; background: var(--accent); color: #fff; border-radius: 12px;
    font-size: 16px; font-weight: 700; text-decoration: none;
}
.dl-q-btn:hover { background: #6d28d9; }
.dl-link-btn {
    background: var(--card); border: 1px solid #2b2b48; border-radius: 999px;
    padding: 9px 16px; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer;
}
.dl-link-btn:hover { border-color: var(--accent2); color: var(--accent2); }

/* Anime auto-play next overlay */
.next-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.75); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; }
.next-overlay[hidden] { display: none; }
.next-box { background: #1a1a26; border: 1px solid rgba(255,255,255,.15); border-radius: 12px; padding: 22px; text-align: center; max-width: 420px; }
.next-box p { margin: 0 0 14px; font-size: 15px; }
.next-box .btn-ghost, .next-box .btn-play { margin: 0 4px; }
.autoplay-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }
.autoplay-toggle input { accent-color: var(--accent); }

/* ---- Series (live EgyDead links) ---- */
.card .poster-ph { position: relative; aspect-ratio: 2 / 3; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #3b2a6b, #1a1a2e 60%, #0f0f1a); }
.poster-initial { font-size: 64px; font-weight: 800; color: rgba(255,255,255,.85); line-height: 1; }
.card .poster-ph .play-badge { position: absolute; right: 10px; bottom: 10px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 28px 0 8px; font-size: 15px; }
.episodes { margin-top: 28px; }
.episodes h2 { font-size: 20px; margin-bottom: 12px; }
.ep-nav { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.downloads { display: flex; gap: 10px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.downloads .lbl { color: var(--muted); font-size: 14px; }
.dl-btn { display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: #fff; border-radius: 12px; padding: 10px 18px; font-size: 15px; font-weight: 700; text-decoration: none; border: 0; cursor: pointer; min-height: 44px; }
.dl-btn:hover { filter: brightness(1.12); }
