:root {
            --bg-color: #08080a;
            --card-bg: #121216;
            --text-color: #e1e1e6;
            --primary: #00adb5;
            --primary-hover: #007a80;
            --danger: #ef4444;
            --danger-hover: #dc2626;
            --success: #22c55e;
            --success-hover: #16a34a;
            --input-bg: #1a1a22;
            --border-color: #262630;
            --accent: #ffb703;
            --glow: 0 0 10px rgba(0, 173, 181, 0.3);
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: var(--bg-color);
            color: var(--text-color);
            margin: 0;
            padding: 20px;
            display: flex;
            justify-content: center;
            align-items: flex-start;
            min-height: 100vh;
            box-sizing: border-box;
        }

        .workspace {
            display: flex;
            gap: 25px;
            width: 100%;
            max-width: 1200px;
            align-items: stretch;
        }

        .panel {
            background-color: var(--card-bg);
            padding: 25px;
            border-radius: 14px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
            border: 1px solid var(--border-color);
            flex: 1;
            box-sizing: border-box;
        }

        .preview-panel {
            display: flex;
            flex-direction: column;
            background: linear-gradient(145deg, #121216, #0b0b0e);
        }

        h2, h3 {
            color: var(--primary);
            margin-top: 0;
            margin-bottom: 20px;
            text-align: center;
            text-shadow: var(--glow);
        }

        h3 {
            color: var(--accent);
            border-bottom: 1px dashed var(--border-color);
            padding-bottom: 10px;
            text-shadow: none;
        }

        .form-group {
            margin-bottom: 15px;
        }

        label {
            display: block;
            margin-bottom: 6px;
            font-size: 13px;
            font-weight: bold;
        }

        input[type="text"], input[type="url"], select {
            width: 100%;
            padding: 11px;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            background-color: var(--input-bg);
            color: #fff;
            box-sizing: border-box;
            font-size: 14px;
            transition: all 0.3s;
        }

        input:focus, select:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: var(--glow);
        }

        .file-drop-area {
            border: 2px dashed var(--primary);
            border-radius: 8px;
            padding: 20px;
            text-align: center;
            background-color: var(--input-bg);
            cursor: pointer;
            margin-bottom: 15px;
            font-size: 14px;
            transition: background 0.3s;
        }

        .file-drop-area:hover {
            background-color: #20202a;
        }

        .file-drop-area input[type="file"] {
            display: none;
        }
        .m3u-extract-row { display: flex; gap: 8px; }
        .m3u-extract-row input { flex: 1; min-width: 0; }
        .m3u-extract-row .btn-extract {
            flex: 0 0 auto; padding: 10px 16px; background: var(--primary); color: #fff;
        }
        .m3u-extract-row .btn-extract:hover { background: var(--primary-hover); }

        .btn-group {
            display: flex;
            gap: 10px;
            margin-bottom: 15px;
            flex-wrap: wrap;
        }

        button {
            padding: 12px;
            color: white;
            background-color: #2b2b36;
            border: none;
            border-radius: 6px;
            font-size: 14px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        button.btn-main {
            flex: 2;
            background-color: var(--primary);
        }

        button.btn-main:hover {
            background-color: var(--primary-hover);
            box-shadow: var(--glow);
        }

        button.btn-success {
            flex: 1.5;
            background-color: var(--success);
        }

        button.btn-success:hover {
            background-color: var(--success-hover);
            box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
        }

        button.btn-danger {
            flex: 1;
            background-color: var(--danger);
        }

        button.btn-danger:hover {
            background-color: var(--danger-hover);
        }

        .tv-screen {
            background-color: #060608;
            border: 1px solid var(--border-color);
            border-radius: 8px;
            padding: 15px;
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: flex-start;
            min-height: 250px;
        }

        .screen-placeholder {
            margin: auto;
            text-align: center;
            color: #4b5563;
            font-size: 14px;
        }

        .channel-stats {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 10px;
            margin-bottom: 15px;
        }

        .stat-card {
            background: #181822;
            padding: 8px;
            border-radius: 6px;
            text-align: center;
            font-size: 11px;
            border: 1px solid var(--border-color);
        }

        .stat-card div:last-child {
            font-size: 15px;
            font-weight: bold;
            color: var(--primary);
            margin-top: 4px;
        }

        .mock-epg-list {
            display: block;
            overflow-y: auto;
            max-height: clamp(220px, 42vh, 520px);
            padding-left: 2px;
        }

        .epg-item {
            background: #14141a;
            padding: 10px;
            border-radius: 6px;
            font-size: 13px;
            border-right: 4px solid var(--primary);
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-left: 1px solid var(--border-color);
        }

        .epg-item .badge {
            background: #22222e;
            padding: 2px 6px;
            border-radius: 4px;
            font-size: 11px;
            color: var(--accent);
        }

        .status-msg {
            font-size: 13px;
            color: var(--accent);
            text-align: center;
            margin-bottom: 15px;
            display: none;
            font-weight: bold;
        }

        .server-selector-container {
            display: none;
            background-color: #11222c;
            border: 1px solid #1f3d4f;
            padding: 12px;
            border-radius: 8px;
            margin-bottom: 15px;
        }

        .divider {
            text-align: center;
            margin: 15px 0;
            position: relative;
            font-size: 12px;
            color: #4b5563;
        }
        .divider::before, .divider::after {
            content: "";
            position: absolute;
            top: 50%;
            width: 35%;
            height: 1px;
            background: var(--border-color);
        }
        .divider::before { right: 0; }
        .divider::after { left: 0; } .btn-danger:disabled { opacity: .5; cursor: not-allowed; }

        .player-box { background:#000; border:1px solid var(--border-color); border-radius:8px; padding:8px; margin-bottom:12px; }
        .player-box video { width:100%; max-width:400px; aspect-ratio:16/9; background:#000; display:block; margin:0 auto; border-radius:6px; }
        .player-title { font-size:12px; font-weight:bold; color:var(--primary); margin-bottom:6px; text-align:center; }
        .player-status { font-size:11px; color:#9ca3af; text-align:center; margin:6px 0; min-height:14px; }
        .player-controls { display:flex; gap:6px; flex-wrap:wrap; justify-content:center; }
        .player-controls button, .player-controls select { padding:6px 10px; font-size:11px; border-radius:4px; border:1px solid var(--border-color); background:#22222a; color:var(--text-color); width:auto; }
        .player-controls button.vlc { background:#ea580c; border-color:#ea580c; color:#fff; }
        .player-controls button.vlc:hover { background:#c2410c; }
        .idm-icon { width:18px; height:18px; object-fit:contain; vertical-align:-3px; margin-inline-end:6px; }
        .epg-item { cursor:pointer; }
        .epg-item:hover { background:#1c1c26; }
        .epg-item.playing { border-right-color: var(--success); background:#16241c; }
        .play-btn { background:none; border:none; color:var(--success); font-size:14px; padding:0 6px; cursor:pointer; }

        .proxy-box { background:#11161c; border:1px solid var(--border-color); border-radius:8px; padding:8px 10px; margin-bottom:12px; font-size:12px; }
        .proxy-box summary { cursor:pointer; color:var(--accent); font-weight:bold; }
        .wyzie-box { background:#101820; border:1px solid var(--border-color); border-radius:8px; padding:8px 10px; margin-top:10px; font-size:12px; }
        .wyzie-box summary { cursor:pointer; color:var(--accent); font-weight:bold; }
        .wyzie-box .proxy-row { margin-top:8px; }
        .wyzie-box .proxy-row input { flex:1 1 140px; min-width:0; }
        .wyzie-box a { color:#8aa4d6; }
        .proxy-row { display:flex; gap:6px; margin-top:8px; flex-wrap:wrap; }
        .proxy-row input { flex:1 1 220px; padding:7px; font-size:12px; }
        .proxy-row select, .proxy-row button { width:auto; padding:7px 10px; font-size:12px; }
        .proxy-row button { background:#1e3a8a; }
        .proxy-help { color:#9ca3af; font-size:11px; line-height:1.7; margin-top:6px; }

        .ch-logo { width:34px; height:34px; object-fit:contain; margin-left:8px; border-radius:4px; background:#0b0b0e; }
.search-hint { font-size:11px; color:#8aa4d6; margin-top:5px; line-height:1.5; }
.search-hint[hidden] { display:none; }
        .ctl-row { display:flex; gap:6px; margin-bottom:10px; flex-wrap:wrap; }
        .ctl-row select { flex:1 1 120px; width:auto; padding:7px; font-size:12px; }
        .ctl-row button { padding:7px 10px; font-size:12px; background:#1e3a8a; }
        @media (max-width: 850px) {
            .workspace {
                flex-direction: column;
            }
        }
#installBtn{position:fixed;bottom:12px;left:12px;z-index:50;width:auto;padding:8px 14px;box-shadow:0 2px 10px #000a;}
#installBtn[hidden]{display:none;}
.dot{display:inline-block;width:10px;height:10px;border-radius:50%;margin-inline-end:6px;vertical-align:middle;}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.blink { animation: blink 1s ease-in-out infinite; }
button:disabled { cursor: not-allowed; }
.epg-item { height:48px; margin-bottom:6px; box-sizing:border-box; overflow:hidden; }
.epg-item > div { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ch-logo { width:28px !important; height:28px !important; }
dialog { background:#14141a; color:#e5e7eb; border:1px solid #2a2a35; border-radius:10px; padding:18px; max-width:min(720px,94vw); max-height:85vh; overflow:auto; }
dialog::backdrop { background:#000a; }
dialog table { width:100%; border-collapse:collapse; font-size:13px; }
dialog th, dialog td { text-align:start; padding:7px 6px; border-bottom:1px solid #22222e; }
dialog tr:hover td { background:#1c1c26; }

.poster-panel { margin-top:14px; border:1px solid var(--border-color); border-radius:10px; padding:10px; background:#11161c; }
.poster-head { display:flex; gap:6px; align-items:center; flex-wrap:wrap; margin-bottom:8px; }
.poster-head button { width:auto; padding:5px 12px; font-size:12px; background:#22222a; }
.poster-head button.on { background:#1e3a8a; }
.poster-head input { flex:1 1 120px; padding:6px; font-size:12px; }
.poster-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(96px,1fr)); gap:10px; max-height:380px; overflow-y:auto; }
.poster-card { position:relative; cursor:pointer; min-width:0; }
.poster-card img { width:100%; aspect-ratio:2/3; object-fit:cover; border-radius:6px; background:#0b0b0e; display:block; }
.poster-card:hover img { outline:2px solid var(--accent, #4f8cff); }
.poster-card span { display:block; font-size:11px; margin-top:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.poster-card .rate { position:absolute; top:4px; inset-inline-start:4px; background:#000b; border-radius:4px; padding:1px 5px; font-size:10px; }
.epg-item:focus, .poster-card:focus { outline:3px solid #ffb703; outline-offset:2px; background:#1c1c26; }
.tv :focus { outline:3px solid #ffb703; outline-offset:2px; }
.tv #proxyBox, .tv #installBtn { display:none; }
.sec-hidden { display:none !important; }
#secBtn { position:fixed; top:10px; inset-inline-start:10px; z-index:50; width:auto; padding:6px 12px; font-size:12px; opacity:.85; }
.tv #secBtn { display:none; }

#myServersBar {
    position: fixed; top: 6px; left: 50%; transform: translateX(-50%); z-index: 170;
    width: min(720px, calc(100vw - 20px)); min-height: 38px; box-sizing: border-box;
    display: flex; align-items: center; gap: 8px; padding: 5px 7px;
    border: 1px solid #3f3f46; border-radius: 12px; background: #141418f5;
    box-shadow: 0 10px 28px #0009; backdrop-filter: blur(8px); direction: ltr;
}
#myServersBar[hidden] { display: none; }
.my-servers-title { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; padding: 0 4px; color: #f6c445; font-size: 12px; font-weight: 800; letter-spacing: .3px; }
.my-servers-title small { min-width: 19px; padding: 2px 5px; border-radius: 999px; background: #2a2a31; color: #d7d7df; text-align: center; font-size: 10px; }
.my-servers-list { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; min-width: 0; overflow-x: auto; overflow-y: hidden; padding: 1px 2px 3px; scrollbar-width: none; }
.my-servers-list::-webkit-scrollbar { height: 0; }
.my-server-item { display: flex; align-items: center; flex: 0 0 auto; max-width: min(260px, 70vw); border: 1px solid #34343c; border-radius: 9px; background: #1d1d22; overflow: hidden; }
.my-server-use { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 6px 8px; border: 0; background: transparent; color: #fff; font: inherit; font-size: 11px; cursor: pointer; }
.my-server-use:hover, .my-server-use:focus { outline: 2px solid #f6c445; outline-offset: -2px; background: #26262d; }
.my-server-dot { flex: 0 0 auto; font-size: 10px; }
.my-server-host { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; }
.my-server-remove { flex: 0 0 auto; width: 25px; align-self: stretch; padding: 0; border: 0; border-inline-start: 1px solid #34343c; background: #26262d; color: #ffb4bc; font-size: 16px; line-height: 1; cursor: pointer; }
.my-server-remove:hover, .my-server-remove:focus { outline: 2px solid #ff8a95; outline-offset: -2px; background: #4a1d24; }
body.my-servers-on.login-mode #loginScreen { padding-top: 64px; }
body.media-mode #myServersBar, body.watching #myServersBar { display: none !important; }

#loginScreen { display:none; }
body.login-mode > *:not(#loginScreen):not(#dlg):not(#introScreen):not(#myServersBar):not(#prayerAlertDlg) { display:none !important; }
body.login-mode #loginScreen { display:flex; min-height:100vh; box-sizing:border-box; align-items:center; justify-content:center; padding:20px; background:radial-gradient(circle at 50% 0%, #1b2440 0%, #0f1115 62%); }
.login-card { width:min(400px,100%); background:#14141a; border:1px solid #2a2a35; border-radius:16px; padding:28px 24px; box-shadow:0 10px 40px #000a; }
.login-logo { font-size:44px; text-align:center; }
.login-card h1 { text-align:center; margin:6px 0 2px; font-size:22px; }
.login-sub { text-align:center; color:#9ca3af; font-size:13px; margin:0 0 14px; }
.login-card label { display:block; margin:12px 0 5px; font-size:13px; color:#cbd5e1; }
.login-card input[type=text], .login-card input[type=password] { width:100%; box-sizing:border-box; padding:11px; border-radius:8px; font-size:15px; }
.pw-row { display:flex; gap:6px; }
.pw-row button { width:auto; padding:0 14px; background:#22222a; }
.lg-divider { display:flex; align-items:center; gap:10px; margin:16px 0 4px; color:#6b7280; font-size:12px; }
.lg-divider::before, .lg-divider::after { content:""; height:1px; flex:1; background:#2a2a35; }
.lg-help { margin:5px 0 0; color:#8b93a7; font-size:11px; line-height:1.6; }
.login-card .lg-remember { display:flex; align-items:center; gap:8px; cursor:pointer; }
.login-card .lg-remember input { width:auto; }
.lg-msg { min-height:20px; font-size:13px; margin-top:10px; line-height:1.6; }
.lg-btn { width:100%; margin-top:6px; padding:12px; font-size:16px; font-weight:bold; background:#4f8cff; color:#fff; border-radius:8px; }
.lg-link { display:block; text-align:center; margin-top:14px; font-size:12px; color:#8aa4d6; }
#logoutBtn { position:fixed; top:10px; inset-inline-start:120px; z-index:50; width:auto; padding:6px 12px; font-size:12px; opacity:.85; background:#3b1d1d; }
.tv #logoutBtn { top:10px; inset-inline-start:10px; }

#toast{position:fixed;bottom:20px;left:50%;transform:translate(-50%,16px);max-width:min(90vw,520px);background:#14141a;color:#e5e7eb;border:1px solid #22c55e;border-radius:8px;padding:10px 16px;font-size:13px;text-align:center;opacity:0;pointer-events:none;transition:opacity .25s,transform .25s;z-index:200;box-shadow:0 6px 24px #000a;}
#toast.on{opacity:1;transform:translate(-50%,0);}
#videoEl::cue{background:rgba(0,0,0,.72);color:#fff;font-size:92%;line-height:1.35;unicode-bidi:plaintext;}
#videoEl::cue-region{background:rgba(0,0,0,.5);}
button:focus-visible,select:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px;}
@media (max-width:520px){
    #secBtn,#logoutBtn{font-size:11px;padding:5px 9px;}
    #logoutBtn{inset-inline-start:104px;}
    .player-box video{max-width:100%;}
    .poster-grid{grid-template-columns:repeat(auto-fill,minmax(82px,1fr));}
    body{padding:10px;}
}

/* ===== صفحة المشاهدة: المشغّل بعرض الصفحة وقائمة الوسائط تحته ===== */
.watch-page { position:fixed; inset:0; z-index:120; background:#0a0c10; overflow-y:auto; -webkit-overflow-scrolling:touch; }
.watch-page[hidden] { display:none; }
body.watching { overflow:hidden; }
.watch-bar { position:sticky; top:0; z-index:3; display:flex; align-items:center; gap:8px; padding:8px 14px; background:#11151d; border-bottom:1px solid #2a2a35; }
.watch-bar strong { flex:1; min-width:0; font-size:14px; color:#e5e7eb; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.watch-bar button { width:auto; padding:6px 12px; font-size:12px; background:#22222a; }
.watch-body { width:100%; max-width:1600px; margin:0 auto; padding:12px 16px 28px; box-sizing:border-box; display:grid; grid-template-columns:minmax(0,1fr) minmax(300px,400px); gap:16px; align-items:start; }
.watch-video-slot, .watch-list-col { min-width:0; }
.watch-page .player-box { max-width:960px; margin:0 auto 10px; padding:10px; }
.watch-media { display:flex; gap:12px; align-items:center; justify-content:center; }
.watch-media .player-box { flex:1; min-width:0; }
.watch-poster { flex:0 0 auto; width:clamp(180px,26vw,330px); margin-bottom:10px; border:1px solid var(--border-color); border-radius:10px; overflow:hidden; background:#0b0b0e; }
.watch-poster[hidden] { display:none; }
.watch-poster img { display:block; width:100%; aspect-ratio:3/4; object-fit:cover; background:#0b0b0e; }
.watch-summary { padding:10px 12px; font-size:12px; line-height:1.8; color:#d1d5db; text-align:start; border-top:1px solid #222; background:#0d0d10; max-height:240px; overflow-y:auto; }
.watch-summary[hidden] { display:none; }
.watch-page .watch-list-col { display:none; }
.watch-page .watch-body { grid-template-columns:minmax(0,1fr); }
.watch-bar .watch-back {
    width: 38px; height: 38px; padding: 0; border-radius: 50%;
    border: 2px solid #b9b9be; background: transparent; color: #fff;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.watch-bar .watch-back svg { width: 52%; height: 52%; }
.watch-bar .watch-back:hover, .watch-bar .watch-back:focus { background: #333338; border-color: #cfcfd4; outline: 2px solid #fff; outline-offset: 2px; }
@media (max-width:760px){ .watch-poster { display:none; } }
.watch-page .player-box video { width:100%; max-width:100%; }
.watch-page .player-controls button, .watch-page .player-controls select { font-size:12px; padding:7px 12px; }
.watch-sec-title { font-size:13px; font-weight:bold; color:var(--primary); margin:14px 0 8px; }
.watch-list-col .watch-sec-title { margin:0 0 8px; }
.watch-page .mock-epg-list { max-height:max(280px,calc(100vh - 250px)); }
.watch-page #playerStatus, .watch-page .player-title { font-size:13px; }
@media (max-width:900px){
    .watch-body { grid-template-columns:1fr; }
    .watch-list-col .watch-sec-title { margin-top:6px; }
    .watch-page .mock-epg-list { max-height:min(56vh,640px); }
}
@media (max-width:520px){
    .watch-body { padding:8px 8px 22px; }
    .watch-bar strong { font-size:12px; }
    .watch-bar button { padding:5px 9px; font-size:11px; }
    .watch-page .mock-epg-list { max-height:60vh; }
}

/* ===== قنوات الباقة بجانب مشغّل البث الحي ===== */
.watch-page.live-package-mode .watch-body { grid-template-columns:minmax(0,1fr) minmax(320px,400px); }
.watch-page.live-package-mode .watch-list-col {
    display:block; position:sticky; top:70px; box-sizing:border-box;
    max-height:calc(100vh - 92px); overflow-y:auto; padding:12px;
    border:1px solid #2a2a35; border-radius:10px; background:#11151d;
}
.watch-page.live-package-mode #kindSel,
.watch-page.live-package-mode #catFilter { display:none !important; }
.watch-page.live-package-mode .mock-epg-list { max-height:none; overflow:visible; }
.watch-page.live-package-mode .epg-item { height:54px; }
@media (max-width:760px) {
    .watch-page.live-package-mode .watch-body { grid-template-columns:1fr; }
    .watch-page.live-package-mode .watch-list-col { position:static; max-height:none; margin-top:12px; overflow:visible; }
    .watch-page.live-package-mode .mock-epg-list { max-height:60vh; overflow-y:auto; }
}

/* ===== شريط المواسم والحلقات الأفقي أسفل المشغّل ===== */
.watch-page.episode-mode .watch-list-col { display:none; }
.watch-page.episode-mode .watch-body { grid-template-columns:minmax(0,1fr); }
.ep-bar { display:flex; align-items:center; gap:8px; flex-wrap:wrap; width:100%; box-sizing:border-box; margin:6px 0 10px; padding:10px; background:#11161c; border:1px solid var(--border-color); border-radius:10px; }
.ep-bar[hidden] { display:none; }
.ep-bar .ep-back { width:auto; padding:7px 12px; font-size:12px; background:#22222a; }
.ep-bar .ep-label { font-size:12px; font-weight:bold; color:var(--accent); }
.ep-bar select { width:auto; padding:7px 10px; font-size:13px; }
.ep-chips { display:flex; flex-wrap:wrap; gap:6px; flex:1 1 240px; min-width:0; padding:2px 0; }
.ep-chip { flex:0 0 auto; width:auto; padding:7px 12px; font-size:12px; background:#1b2333; border:1px solid #2a3a55; }
.ep-chip:hover { background:#22314a; }
.ep-chip.on { background:#1e3a8a; border-color:#4f8cff; box-shadow:0 0 8px rgba(79,140,255,.5); }
@media (max-width:520px){
    .ep-bar { padding:8px; }
    .ep-chip { padding:6px 9px; font-size:11px; }
}

.ep-bar .ep-series-download { width:auto; padding:7px 12px; font-size:12px; background:#18351f; border-color:#2f6b3d; }
.download-ep-list { max-height:38vh; overflow-y:auto; margin:10px 0; padding:8px 12px; border:1px solid var(--border-color); border-radius:10px; background:#11161c; }
.download-season + .download-season { margin-top:12px; padding-top:8px; border-top:1px solid #263041; }
.download-season h4 { margin:4px 0 8px; color:var(--accent); font-size:13px; }
.download-ep-option { display:flex; align-items:flex-start; gap:8px; padding:6px 4px; font-size:13px; cursor:pointer; }
.download-ep-option:hover { background:#1a2230; border-radius:6px; }
.download-ep-option input { width:auto; margin:2px 0 0; flex:0 0 auto; }
.download-ep-list input:disabled { cursor:not-allowed; }
@media (max-width:520px){
    .download-ep-list { max-height:42vh; }
    .download-ep-option { font-size:12px; }
}

/* ===== زر السيرفرات الشغالة أعلى الصفحة ===== */
@property --srv-ang { syntax:'<angle>'; inherits:false; initial-value:0deg; }
#srvBtn { position:fixed; top:10px; inset-inline-end:10px; z-index:50; width:auto; padding:7px 14px; font-size:12px; font-weight:bold; color:#e5e7eb; background:linear-gradient(135deg,#1e3a8a,#152238); border:1px solid #4f8cff; border-radius:10px; animation:srvGlow 2.4s ease-in-out infinite; }
#srvBtn::before { content:''; position:absolute; inset:-3px; border-radius:13px; padding:2px; background:conic-gradient(from var(--srv-ang), rgba(79,140,255,0) 0deg, #4f8cff 90deg, #00e5ff 150deg, rgba(0,229,255,0) 230deg, rgba(79,140,255,0) 360deg); -webkit-mask:linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite:xor; mask:linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite:exclude; animation:srvSpin 2.6s linear infinite; pointer-events:none; }
@keyframes srvSpin { to { --srv-ang:360deg; } }
@keyframes srvGlow { 0%,100% { box-shadow:0 0 6px rgba(79,140,255,.5); } 50% { box-shadow:0 0 18px rgba(0,229,255,.9), 0 0 30px rgba(79,140,255,.5); } }
@media (prefers-reduced-motion: reduce){ #srvBtn, #srvBtn::before { animation:none; } }
.srv-menu { position:fixed; top:44px; inset-inline-end:10px; z-index:60; width:min(320px,92vw); max-height:min(60vh,420px); overflow-y:auto; background:#14141a; border:1px solid #2a2a35; border-radius:10px; box-shadow:0 10px 30px #000b; padding:6px; }
.srv-menu[hidden] { display:none; }
.srv-item { display:flex; align-items:center; gap:6px; width:100%; text-align:start; background:none; border:none; color:#e5e7eb; padding:8px; border-radius:7px; cursor:pointer; font-size:12px; }
.srv-item:hover, .srv-item.on { background:#1e2a44; }
.srv-item.on { outline:1px solid #4f8cff; }
.srv-row { display:flex; align-items:center; gap:6px; flex:1; min-width:0; }
.srv-name { font-weight:bold; white-space:nowrap; }
.srv-host { color:#9ca3af; font-size:11px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; direction:ltr; }
.srv-tag { font-size:10px; padding:1px 6px; border-radius:4px; white-space:nowrap; }
.srv-tag.ok { background:#14351f; color:#4ade80; }
.srv-tag.bad { background:#3a1717; color:#f87171; }
.srv-empty { padding:12px; color:#9ca3af; font-size:12px; text-align:center; }
@media (max-width:520px){
    #srvBtn { font-size:11px; padding:5px 9px; }
    .srv-menu { top:40px; }
}

/* ============================================================
   واجهة نتفليكس (2026-11-20) — طبقة تجاوزات فوق التنسيق الأصلي
   ============================================================ */
:root {
    --bg-color: #000000;
    --card-bg: #141414;
    --text-color: #ffffff;
    --primary: #e50914;
    --primary-hover: #f6121d;
    --danger: #e50914;
    --danger-hover: #f6121d;
    --success: #46d369;
    --success-hover: #3bb95a;
    --input-bg: #1c1c1c;
    --border-color: #2a2a2a;
    --accent: #ffb703;
    --glow: none;
}

body {
    background: #000 !important;
    background-image: none !important;
    color: #fff;
    display: block;
    padding: 0;
    font-family: "Segoe UI", Tahoma, "Dubai", sans-serif;
}

/* ---- الهيكل: شريط جانبي + المحتوى ---- */
.nf-shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; background: #000; }
.nf-side {
    position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto;
    background: #0b0b0b; border-inline-end: 1px solid #1f1f1f;
    padding: 18px 14px; display: flex; flex-direction: column; gap: 16px;
}
.nf-brand { padding: 2px 6px 4px; }
.nf-logo { color: #e50914; font-weight: 900; font-size: 27px; letter-spacing: .5px; }
.nf-nav { display: flex; flex-direction: column; gap: 2px; }
.nf-nav button {
    width: 100%; text-align: start; background: transparent; border: 0; color: #b3b3b3;
    font-size: 14px; font-weight: 500; padding: 10px 12px; border-radius: 4px;
    border-inline-start: 3px solid transparent; transition: .15s;
}
.nf-nav button:hover { color: #fff; background: #171717; }
.nf-nav button.on { color: #fff; background: #171717; border-inline-start-color: #e50914; }
.nf-cats label { display: block; font-size: 11px; color: #777; margin-bottom: 6px; }
.nf-cats select { width: 100%; background: #1c1c1c; border: 1px solid #2a2a2a; color: #fff; border-radius: 4px; padding: 8px; font-size: 12.5px; }
.nf-server { border: 1px solid #222; border-radius: 6px; background: #111; padding: 10px; }
.nf-server summary { cursor: pointer; font-size: 13px; color: #ddd; font-weight: 600; }
.nf-server .file-drop-area {
    border: 1px dashed #3a3a3a; background: #161616; border-radius: 4px;
    padding: 12px 10px; font-size: 12px; margin: 10px 0; text-align: center; color: #b3b3b3;
}
.nf-server .file-drop-area:hover { border-color: #e50914; background: #1a1a1a; }
.nf-server .file-drop-area input[type=file] { display: none; }
.nf-server .form-group { margin: 8px 0; }
.nf-server label { font-size: 11.5px; color: #9a9a9a; }
.nf-server input[type=url] { width: 100%; font-size: 12px; padding: 8px; border-radius: 4px; background: #1c1c1c; border: 1px solid #2a2a2a; color: #fff; }
.nf-server .btn-group { display: flex; gap: 6px; margin: 6px 0 2px; }
.nf-server .btn-group button { font-size: 11.5px; padding: 8px 6px; border-radius: 4px; }
.nf-server .btn-success { background: #e50914; color: black; }
.nf-server .btn-danger { background: #222; color: #ddd; }
.nf-side-foot { margin-top: auto; display: flex; flex-wrap: wrap; gap: 6px; }
#srvBtn, #secBtn, #logoutBtn, #installBtn {
    position: static; inset: auto; opacity: 1; width: auto; font-size: 11.5px; padding: 7px 10px;
    background: #1c1c1c; border: 1px solid #2a2a2a; color: #ccc; border-radius: 4px;
    box-shadow: none; animation: none !important;
}
#srvBtn::before { display: none !important; }
#secBtn:hover, #srvBtn:hover, #logoutBtn:hover { border-color: #e50914; color: #fff; }
#logoutBtn { color: #f6a5a5; }
#installBtn[hidden] { display: none !important; }

.nf-main { min-width: 0; padding-bottom: 44px; }
.nf-top {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
    padding: 14px 28px; background: linear-gradient(180deg, rgba(0,0,0,.96), rgba(0,0,0,.72) 70%, transparent);
}
.nf-top .form-group { margin: 0; flex: 1; max-width: 520px; }
.search-field { position: relative; display: flex; align-items: center; }
.search-field .sic { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: #8a8a8a; font-size: 14px; pointer-events: none; }
.search-field input {
    width: 100%; height: 40px; border-radius: 4px; background: #141414; border: 1px solid #333;
    padding-inline-start: 38px; color: #fff; font-size: 13.5px;
}
.search-field input:focus { border-color: #e50914; box-shadow: none; }
.nf-top-chip { margin-inline-start: auto; font-size: 12px; color: #9a9a9a; border: 1px solid #2a2a2a; border-radius: 999px; padding: 7px 12px; white-space: nowrap; }

/* ---- البانر ---- */
.nf-hero { position: relative; margin: 0 28px 26px; border-radius: 8px; overflow: hidden; min-height: 380px; display: flex; align-items: flex-end; background: #101010; }
.nf-hero-bg { position: absolute; inset: 0; background-size: cover; background-position: center 18%; filter: brightness(.55); }
.nf-hero::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, rgba(0,0,0,.92) 0%, rgba(0,0,0,.55) 50%, rgba(0,0,0,.15) 100%),
                linear-gradient(0deg, #000 0%, rgba(0,0,0,0) 50%);
}
.nf-hero-inner { position: relative; z-index: 1; padding: 36px 40px; max-width: 660px; }
.nf-tag { color: #e50914; font-weight: 700; font-size: 12px; letter-spacing: 1px; }
.nf-hero h1 { font-size: 40px; margin: 10px 0 12px; line-height: 1.25; color: #fff; }
.nf-hero p { color: #cfcfcf; font-size: 15px; line-height: 1.8; margin: 0 0 20px; }
.nf-hero-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.nf-play { background: #fff; color: #000; font-weight: 800; padding: 12px 26px; border-radius: 4px; font-size: 15px; border: 0; }
.nf-play:hover { background: #e6e6e6; }
.nf-info { background: rgba(109,109,110,.55); color: #fff; padding: 12px 22px; border-radius: 4px; border: 0; font-size: 14px; }
.nf-info:hover { background: rgba(109,109,110,.35); }

/* ---- صفوف الأفلام ---- */
.nf-rails { padding: 0 0 10px; }
.nf-rail-empty { margin: 0 28px; padding: 28px; border: 1px dashed #262626; border-radius: 8px; color: #8a8a8a; font-size: 14px; text-align: center; background: #0d0d0d; }
.nf-row { margin-bottom: 26px; }
.nf-row-head { display: flex; align-items: baseline; gap: 10px; padding: 0 28px; margin-bottom: 10px; }
.nf-row-head h2 { font-size: 19px; margin: 0; color: #e5e5e5; }
.nf-more { margin-inline-start: auto; background: transparent; border: 0; color: #8a8a8a; font-size: 12.5px; padding: 4px 6px; }
.nf-more:hover { color: #fff; }
.nf-rail-wrap { position: relative; }
.nf-rail { display: flex; gap: 10px; overflow-x: auto; padding: 6px 28px 14px; scroll-behavior: smooth; scrollbar-width: none; }
.nf-rail::-webkit-scrollbar { display: none; }
.nf-card { flex: 0 0 150px; cursor: pointer; transition: transform .18s ease; outline: none; border-radius: 4px; }
.nf-card:hover, .nf-card:focus { transform: scale(1.07); z-index: 2; }
.nf-card:focus-visible { box-shadow: 0 0 0 3px #fff; }
.nf-art { position: relative; aspect-ratio: 2/3; border-radius: 4px; overflow: hidden; background: #1a1a1a; display: grid; place-items: center; }
.nf-card.live .nf-art { aspect-ratio: 16/9; background: #fff; }
.nf-art img { width: 100%; height: 100%; object-fit: cover; }
.nf-card.live .nf-art img { object-fit: contain; padding: 10px; background: #fff; }
.nf-ph { font-size: 34px; font-weight: 800; color: #555; }
.nf-live { position: absolute; top: 6px; inset-inline-start: 6px; background: #e50914; color: #fff; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 3px; }
.nf-name { margin-top: 7px; font-size: 12.5px; color: #cfcfcf; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nf-card:hover .nf-name { color: #fff; }
.nf-arrow { position: absolute; top: 0; bottom: 20px; width: 36px; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 26px; opacity: 0; transition: .15s; z-index: 3; }
.nf-rail-wrap:hover .nf-arrow { opacity: .9; }
.nf-arrow.prev { inset-inline-start: 0; }
.nf-arrow.next { inset-inline-end: 0; }

/* ---- المكتبة (كل المحتوى) ---- */
.nf-library { padding: 0 28px; }
.nf-library .panel { background: #0b0b0b; border: 1px solid #1f1f1f; border-radius: 8px; padding: 18px; box-shadow: none; }
.nf-library h3 { color: #e5e5e5; text-align: start; border: 0; font-size: 18px; padding: 0; margin: 0 0 14px; }
.nf-library .tv-screen { background: transparent; border: 0; padding: 0; }
.channel-stats { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.stat-card { background: #171717; border: 1px solid #262626; border-radius: 6px; padding: 10px; font-size: 11.5px; color: #9a9a9a; }
.stat-card div:last-child { color: #fff; }
.mock-epg-list { max-height: clamp(260px, 46vh, 600px); }
.epg-item { background: #141414; border: 1px solid #232323; border-right: 3px solid transparent; border-radius: 4px; }
.epg-item:hover { background: #1f1f1f; }
.epg-item.playing { border-right-color: #e50914; background: #1c1c1c; }
.epg-item .badge { background: #262626; color: #b3b3b3; }
.epg-item strong { color: #eee; }
.ctl-row select, .ctl-row button { background: #1c1c1c; border: 1px solid #2b2b2b; color: #ddd; border-radius: 4px; }
.ctl-row button:hover { border-color: #e50914; color: #fff; }
.screen-placeholder { color: #8a8a8a; }
.poster-panel { background: #111; border-color: #222; }
.proxy-box, .wyzie-box { background: #111; border-color: #222; }
.proxy-box summary, .wyzie-box summary { color: #e50914; }

/* ---- تسجيل الدخول ---- */
body.login-mode #loginScreen { background: radial-gradient(900px 500px at 50% 0%, #1a0506 0%, #000 62%); }
.login-card { background: #141414; border: 1px solid #242424; border-radius: 8px; }
.login-logo { font-size: 40px; }
.login-card h1 { color: #e50914; font-weight: 900; letter-spacing: 1px; }
.lg-btn { background: #e50914; color: #fff; border-radius: 4px; }
.lg-btn:hover { background: #f6121d; }
.lg-link { color: #b3b3b3; }
.pw-row input { flex: 1; min-width: 0; }

/* ---- المشاهد ---- */
.watch-bar { background: #0b0b0b; border-bottom-color: #1f1f1f; }
.watch-page { background: #000; }
.watch-page .player-box { border-radius: 6px; }
.watch-page .player-title, .watch-sec-title { color: #e50914; }
.ep-bar { background: #111; border-color: #222; }
.ep-chip { background: #1c1c1c; border-color: #2a2a2a; }
.ep-chip.on { background: #e50914; border-color: #e50914; color: #fff; box-shadow: none; }
.player-controls button, .player-controls select { background: #1c1c1c; border-color: #2a2a2a; color: #ddd; }
.player-controls button.vlc { background: #ea580c; }

/* ---- التجاوب ---- */
@media (max-width: 900px) {
    .nf-shell { grid-template-columns: 1fr; }
    .nf-side { position: static; height: auto; overflow: visible; }
    .nf-nav { flex-direction: row; flex-wrap: wrap; }
    .nf-nav button { width: auto; }
    .nf-hero { margin: 0 14px 18px; min-height: 300px; }
    .nf-hero-inner { padding: 24px 22px; }
    .nf-hero h1 { font-size: 28px; }
    .nf-top { padding: 12px 14px; }
    .nf-top-chip { display: none; }
    .nf-row-head { padding: 0 14px; }
    .nf-rail { padding: 6px 14px 12px; }
    .nf-library { padding: 0 14px; }
    .nf-rail-empty { margin: 0 14px; }
}
@media (max-width: 520px) {
    .nf-card { flex: 0 0 118px; }
    .nf-hero h1 { font-size: 23px; }
    .nf-side { padding: 12px 10px; }
}

/* ---- فلاتر السنة والنوع (أفلام/مسلسلات) ---- */
.nf-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 12px; }
.nf-filters label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #b3b3b3; font-weight: normal; margin: 0; }
.nf-filters select { background: #141414; border: 1px solid #2a2a2a; color: #fff; border-radius: 6px; padding: 7px 10px; font-size: 13px; min-width: 128px; width: auto; }
.nf-filters select:focus { outline: none; border-color: #e50914; }
.nf-filters button { width: auto; padding: 7px 12px; background: #1c1c1c; border: 1px solid #2a2a2a; border-radius: 6px; color: #ccc; font-size: 13px; }
.nf-filters button:hover { border-color: #e50914; color: #fff; }

/* سمة hidden يجب أن تخفي دائماً حتى لو كان للعنصر display خاص (هيرو/فلاتر/غيرها) */
[hidden] { display: none !important; }

/* ---- تقييم النجوم على بطاقات التصنيفات ---- */
.nf-rate { position: absolute; bottom: 6px; inset-inline-start: 6px; z-index: 2; background: rgba(0,0,0,.72); color: #ffb703; font-size: 11px; letter-spacing: 1px; padding: 2px 7px; border-radius: 4px; pointer-events: none; }

/* ---- البث الحي: بلا أدوات ترجمة ---- */
#watchPage.live-mode #subSel,
#watchPage.live-mode button[onclick="triggerSubFile()"],
#watchPage.live-mode button[onclick="openWyzieBox()"],
#watchPage.live-mode #wyzieBox { display: none !important; }

/* ---- شاشات قصيرة (تلفاز/هاتف أفقي): بطاقة دخول مضغوطة ---- */
@media (max-height: 640px) {
    body.my-servers-on.login-mode #loginScreen { padding-top: 54px; }
    body.login-mode #loginScreen { padding: 8px; align-items: flex-start; overflow-y: auto; }
    .login-card { padding: 14px 16px; width: min(560px, 100%); }
    .login-logo { font-size: 26px; }
    .login-card h1 { font-size: 18px; margin: 2px 0; }
    .login-sub { margin-bottom: 6px; font-size: 12px; }
    .login-card label { margin: 6px 0 3px; }
    .login-card input[type=text], .login-card input[type=password] { padding: 8px; font-size: 14px; }
    .lg-btn { padding: 9px; font-size: 15px; }
    .lg-link { margin-top: 8px; }
}

/* ---- الصفحة الرئيسية للتلفاز (بعد إدخال السيرفرات) ---- */
body.home-mode {
    overflow: hidden;
    --tv-top: clamp(10px, 2.6vh, 30px);
    --tv-right: clamp(14px, 3vw, 44px);
    --tv-server-top: calc(var(--tv-top) + clamp(44px, 6.2vh, 60px));
    --tv-sheet-top: calc(var(--tv-server-top) + 50px);
    --my-servers-shift: 48px;
}
body.my-servers-on.home-mode .prayer-card { top: calc(var(--tv-top) + var(--my-servers-shift)); }
body.my-servers-on.home-mode .tv-settings { top: calc(var(--tv-top) + var(--my-servers-shift)); }
body.my-servers-on.home-mode #srvFab { top: calc(var(--tv-server-top) + var(--my-servers-shift)); }
body.my-servers-on.home-mode #srvSheet { top: calc(var(--tv-sheet-top) + var(--my-servers-shift)); }
body.my-servers-on.home-mode .tv-head { padding-top: calc(clamp(2px, 2.5vh, 26px) + var(--my-servers-shift)); }
body.home-mode #srvFab { top: var(--tv-server-top); right: var(--tv-right); left: auto; bottom: auto; }
body.home-mode #srvSheet { top: var(--tv-sheet-top); right: var(--tv-right); left: auto; bottom: auto; }
body.home-mode .nf-shell { display: none !important; }
.nf-brand { cursor: pointer; }
#tvHome {
    position: fixed; inset: 0; z-index: 60; direction: ltr;
    display: flex; flex-direction: column; overflow: auto;
    background: radial-gradient(1200px 720px at 50% 0%, #17171d 0%, #09090b 55%, #000 100%);
    color: #fff; padding: clamp(12px, 3vh, 34px) clamp(18px, 4vw, 54px) clamp(10px, 2vh, 22px);
}
#tvHome[hidden] { display: none; }
.prayer-card {
    position: absolute; top: clamp(10px, 2.6vh, 30px); left: clamp(14px, 3vw, 44px);
    z-index: 2; direction: rtl; text-align: right; pointer-events: none;
    background: linear-gradient(180deg, rgba(23, 23, 28, .92), rgba(13, 13, 16, .92));
    border: 1px solid #2f2f37; border-radius: 14px;
    padding: clamp(8px, 1.2vh, 14px) clamp(10px, 1.4vw, 18px);
    color: #e8e8ee; font-size: clamp(12px, 1.9vh, 18px); line-height: 1.6;
    box-shadow: 0 10px 26px #0007; backdrop-filter: blur(6px);
}
.prayer-card .pc-city { color: #f6c445; font-weight: 600; }
.prayer-card .pc-line b { color: red; }
.prayer-card #prayerNextTime { color: green; font-variant-numeric: tabular-nums; }
.prayer-card #prayerLeft { color: #7ee2a8; font-weight: 700; letter-spacing: .5px; font-variant-numeric: tabular-nums; }
@media (max-width: 760px), (max-height: 500px) {
    .prayer-card { font-size: 11px; padding: 6px 9px; border-radius: 10px; top: 8px; left: 8px; line-height: 1.5; }
}
body.prayer-alert-open { overflow: hidden; }
#prayerAlertDlg {
    width: 100vw; max-width: none; height: 100vh; max-height: none; margin: 0; padding: 0;
    border: 0; border-radius: 0; overflow: hidden; color: #fff; direction: rtl;
    background: radial-gradient(circle at 50% 35%, #12352b 0%, #071813 48%, #020806 100%);
}
#prayerAlertDlg[open] { display: grid; place-items: center; }
#prayerAlertDlg::backdrop { background: #000; }
.prayer-alert-card {
    width: min(760px, 92vw); max-height: 94vh; overflow: auto; box-sizing: border-box;
    padding: clamp(18px, 4vmin, 44px); text-align: center;
    border: 1px solid rgba(246, 196, 69, .38); border-radius: clamp(18px, 3vmin, 30px);
    background: linear-gradient(180deg, rgba(12, 31, 25, .96), rgba(4, 14, 11, .98));
    box-shadow: 0 24px 90px #000a, inset 0 0 60px rgba(246, 196, 69, .04);
}
.prayer-alert-mosque { font-size: clamp(58px, 12vmin, 112px); line-height: 1.1; filter: drop-shadow(0 8px 18px #0008); animation: prayerGlow 2.4s ease-in-out infinite; }
.prayer-alert-phase { margin-top: 10px; color: #f6c445; font-size: clamp(14px, 2.4vmin, 21px); font-weight: 700; }
.prayer-alert-card h2 { margin: 10px 0 4px; font-size: clamp(28px, 5.4vmin, 54px); line-height: 1.25; color: #fff; }
.prayer-alert-time { margin: 0; color: #a7e7c7; font-size: clamp(16px, 2.8vmin, 25px); font-variant-numeric: tabular-nums; }
.prayer-alert-count { margin: clamp(14px, 3vmin, 28px) 0 12px; color: #f6c445; font-size: clamp(21px, 4vmin, 38px); font-weight: 800; font-variant-numeric: tabular-nums; }
.prayer-alert-track { height: 6px; overflow: hidden; border-radius: 999px; background: #ffffff1c; }
.prayer-alert-track span { display: block; width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #f6c445, #7ee2a8); transition: width 1s linear; }
.prayer-alert-note { margin: 16px 0 0; color: #b8c9c1; font-size: clamp(12px, 2vmin, 17px); line-height: 1.7; }
.prayer-alert-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.prayer-alert-actions .prayer-sound-btn { margin-top: 0; }
.prayer-sound-btn {
    margin-top: 16px; padding: 10px 22px; border-radius: 999px; cursor: pointer;
    border: 1px solid rgba(246, 196, 69, .55); background: rgba(246, 196, 69, .10);
    color: #f6c445; font-family: inherit; font-size: clamp(14px, 2.4vmin, 19px); font-weight: 700;
}
.prayer-sound-btn:hover, .prayer-sound-btn:focus { background: rgba(246, 196, 69, .20); outline: 2px solid #f6c445; outline-offset: 2px; }
.prayer-exit-btn { border-color: rgba(239, 68, 68, .60); background: rgba(239, 68, 68, .12); color: #ffb4bc; }
.prayer-exit-btn:hover, .prayer-exit-btn:focus { background: rgba(239, 68, 68, .22); outline-color: #ff8a95; }
@keyframes prayerGlow { 0%, 100% { transform: scale(1); opacity: .92; } 50% { transform: scale(1.045); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .prayer-alert-mosque { animation: none; } .prayer-alert-track span { transition: none; } }
.tv-settings {
    position: absolute; top: clamp(10px, 2.6vh, 30px); right: clamp(14px, 3vw, 44px); z-index: 4;
    display: flex; align-items: center; gap: 8px; direction: ltr;
    padding: clamp(7px, 1.1vh, 11px) clamp(10px, 1.4vw, 16px);
    border: 1px solid #55555e; border-radius: 11px; background: #17171ce8; color: #fff;
    font-family: inherit; font-size: clamp(12px, 1.8vh, 16px); font-weight: 600; line-height: 1;
    cursor: pointer; backdrop-filter: blur(6px);
    transition: border-color .12s, background .12s, box-shadow .12s;
}
.tv-settings-ico { width: clamp(18px, 2.8vh, 24px); height: clamp(18px, 2.8vh, 24px); display: block; }
.tv-settings-ico svg { width: 100%; height: 100%; display: block; }
.tv-settings:hover, .tv-settings:focus { outline: none; border-color: #f6c445; background: #8b101de8; box-shadow: 0 0 0 2px rgba(246, 196, 69, .35); }
.tv-head { text-align: center; padding-top: clamp(2px, 2.5vh, 26px); }
.tv-clock {
    font-size: clamp(42px, 10vh, 104px); font-weight: 300; line-height: 1.05;
    letter-spacing: 3px; font-variant-numeric: tabular-nums;
}
.tv-date { margin-top: clamp(2px, 1vh, 10px); color: #c9c9d1; font-size: clamp(13px, 2.3vh, 25px); letter-spacing: .4px; direction: rtl; }
.tv-hijri { margin-top: clamp(1px, .6vh, 6px); color: #e3c46f; font-size: clamp(12px, 2.1vh, 22px); letter-spacing: .4px; direction: rtl; }
.tv-grid {
    margin: auto; width: min(1180px, 100%);
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(12px, 2.2vw, 28px);
}
.tv-tile {
    appearance: none; -webkit-appearance: none; cursor: pointer; outline: none;
    height: clamp(80px, 14vh, 136px);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: clamp(7px, 1.5vh, 15px); padding: 10px;
    border: 2px solid #55555e; border-radius: clamp(10px, 1.4vh, 16px);
    background: linear-gradient(180deg, #17171c, #0d0d10); color: #fff;
    font-size: clamp(15px, 2.5vh, 28px); font-weight: 600; letter-spacing: .4px; font-family: inherit;
    transition: transform .12s, border-color .12s, background .12s, box-shadow .12s;
}
.tv-ico { width: clamp(30px, 5.2vh, 56px); height: clamp(30px, 5.2vh, 56px); display: block; }
.tv-ico svg { width: 100%; height: 100%; display: block; }
.tv-tile:hover, .tv-tile:focus, .tv-tile.sel {
    border-color: #f6c445;
    background: linear-gradient(180deg, #ff3548 0%, #b0001c 100%);
    box-shadow: 0 0 0 2px rgba(246, 196, 69, .35), 0 16px 36px #0009;
    transform: translateY(-2px);
}
.tv-tile.bein-sports { border-color: #7e22ce; background: linear-gradient(180deg, #2a1138, #120819); color: #f3e8ff; }
.tv-tile.bein-sports .tv-label { color: #e9d5ff; letter-spacing: .8px; }
.tv-tile.bein-sports:hover, .tv-tile.bein-sports:focus, .tv-tile.bein-sports.sel {
    border-color: #c084fc;
    background: linear-gradient(180deg, #7e22ce, #4c1d95);
    box-shadow: 0 0 0 2px rgba(192, 132, 252, .38), 0 16px 36px #0009;
}
.tv-foot {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
    padding-top: clamp(8px, 1.8vh, 20px);
    color: #cfcfd6; font-size: clamp(12px, 1.8vh, 18px); line-height: 1.6;
}
.tv-foot b { color: #f3f3f6; font-weight: 600; }
.tv-foot-right { color: #9a9aa2; letter-spacing: .6px; white-space: nowrap; }

/* ---- شريط أحدث الأفلام والمسلسلات أسفل الشاشة الرئيسية ---- */
.tv-strip { width: 100%; margin-top: clamp(4px, 1vh, 12px); direction: rtl; }
.tv-strip[hidden] { display: none; }
.tv-strip-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 2px clamp(4px, .8vh, 8px); }
.tv-strip-title { color: #f3f3f6; font-size: clamp(12px, 1.9vh, 18px); font-weight: 600; }
.tv-strip-hint { color: #7b7b84; font-size: clamp(10px, 1.5vh, 13px); }
.tv-strip-row { display: flex; gap: clamp(8px, .9vw, 14px); overflow-x: auto; overflow-y: hidden; padding: 12px 18px 14px; cursor: grab; touch-action: pan-y; user-select: none; overscroll-behavior-x: contain; }
.tv-strip-row.dragging, .tv-strip-row.dragging .strip-card { cursor: grabbing; }
.tv-strip-row.dragging .strip-card { transform: none !important; transition: none; }
.tv-strip-row::-webkit-scrollbar { height: 8px; }
.tv-strip-row::-webkit-scrollbar-thumb { background: #2f2f37; border-radius: 8px; }
.tv-strip-row::-webkit-scrollbar-track { background: #16161b; border-radius: 8px; }
.strip-card {
    position: relative; flex: 0 0 auto; width: clamp(84px, 15vh, 138px); scroll-snap-align: start;
    padding: 0; border: 1px solid #2a2a31; border-radius: 12px; overflow: hidden;
    background: #111116; color: #fff; font-family: inherit; text-align: start; cursor: grab;
    transform-origin: center bottom;
    transition: transform .22s cubic-bezier(.2, .75, .25, 1), border-color .12s, box-shadow .12s;
}
.strip-card img { width: 100%; aspect-ratio: 2 / 3; display: block; object-fit: cover; background: #1a1a20; -webkit-user-drag: none; }
.strip-ph {
    width: 100%; aspect-ratio: 2 / 3; display: flex; align-items: center; justify-content: center;
    color: #55555e; font-size: clamp(20px, 3vh, 30px); font-weight: 700;
    background: linear-gradient(160deg, #1d1d24, #0d0d10);
}
.strip-cap { display: block; padding: 5px 8px 7px; line-height: 1.35; }
.strip-cap b { display: block; font-size: clamp(10px, 1.5vh, 13px); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip-cap span { display: block; color: #9a9aa2; font-size: clamp(9px, 1.3vh, 12px); font-variant-numeric: tabular-nums; }
.strip-badge {
    position: absolute; top: 6px; right: 6px; padding: 1px 6px; border-radius: 6px;
    background: #000000aa; border: 1px solid #ffffff22; color: #fff; font-size: 10px;
    backdrop-filter: blur(3px); pointer-events: none;
}
.strip-card:focus { outline: none; border-color: #f6c445; box-shadow: 0 10px 22px #0009; }
.strip-card:hover, .strip-card:focus-visible {
    z-index: 10; border-color: #f6c445; transform: translateY(-10px) scale(1.14);
    box-shadow: 0 18px 38px #000c, 0 0 0 1px rgba(246, 196, 69, .35);
}

@media (max-width: 760px) {
    body.home-mode { --tv-top: 8px; --tv-right: 8px; --tv-server-top: 48px; --tv-sheet-top: 96px; --my-servers-shift: 44px; }
    body.my-servers-on.home-mode .tv-head { padding-top: calc(42px + var(--my-servers-shift)); }
    .tv-settings { top: 8px; right: 8px; padding: 6px 8px; font-size: 11px; }
    .tv-settings-ico { width: 18px; height: 18px; }
    .tv-head { padding-top: 42px; }
    .tv-grid { gap: 10px; }
    .tv-tile { height: clamp(72px, 14vh, 118px); border-radius: 12px; }
    .tv-label { font-size: clamp(12px, 2.1vh, 18px); }
}
@media (max-height: 560px) {
    .tv-clock { font-size: 40px; }
    .tv-date { font-size: 12px; }
    .tv-tile { height: 74px; }
    .tv-ico { width: 28px; height: 28px; }
    .tv-foot { font-size: 11px; }
    .tv-strip-head { display: none; }
    .tv-strip-row { padding: 12px 12px 14px; }
    .strip-card { width: 62px; border-radius: 8px; }
    .strip-card:hover, .strip-card:focus-visible { transform: translateY(-6px) scale(1.1); }
    .strip-cap { display: none; }
}
@media (max-height: 500px) and (orientation: landscape) {
    body.home-mode { --my-servers-shift: 36px; }
    body.my-servers-on.home-mode .tv-head { padding-top: calc(10px + var(--my-servers-shift)); }
    body.my-servers-on.login-mode #loginScreen { padding-top: 46px; }
    #myServersBar { min-height: 32px; padding: 3px 6px; }
    .my-server-use { padding: 4px 7px; }
    .tv-head { padding-top: 10px; }
    .tv-clock { font-size: 34px; }
    .tv-date { margin-top: 2px; font-size: 12px; }
    .tv-hijri, .tv-foot { display: none; }
    .tv-grid { gap: 10px; }
    .tv-tile { height: 64px; gap: 4px; padding: 6px; }
    .tv-ico { width: 24px; height: 24px; }
    .tv-label { font-size: 12px; }
    .tv-strip { margin-top: 2px; }
    .tv-strip-row { padding: 8px 12px 10px; }
}
@media (max-height: 360px) and (orientation: landscape) {
    body.home-mode { --my-servers-shift: 26px; }
    #myServersBar { min-height: 26px; padding: 1px 4px; }
    .my-servers-list { padding: 0 1px 1px; }
    .my-servers-title { font-size: 10px; }
    .my-server-use { padding: 2px 5px; font-size: 10px; }
    .tv-clock { font-size: 28px; }
    .tv-date { display: none; }
    .tv-grid { gap: 6px; }
    .tv-tile { height: 58px; }
    .tv-ico { width: 22px; height: 22px; }
    .tv-strip-row { padding: 6px 10px 8px; }
}
@media (prefers-reduced-motion: reduce) {
    .strip-card { transition: none; }
    .strip-card:hover, .strip-card:focus-visible { transform: none; }
}

/* ---- صفحة الأفلام/المسلسلات/البث (شبكة ملصقات على طراز التلفاز) ---- */
body.media-mode { overflow: hidden; }
body.media-mode .nf-shell { display: none !important; }
#mediaPage {
    position: fixed; inset: 0; z-index: 58; direction: ltr;
    display: flex; flex-direction: column; background: #1a1a1c; color: #fff;
    font-family: inherit; overflow: hidden;
}
#mediaPage[hidden] { display: none; }
.mp-top {
    display: flex; align-items: center; gap: clamp(10px, 2vw, 36px);
    padding: clamp(8px, 1.4vh, 16px) clamp(14px, 2.2vw, 36px);
    background: #1d1d1f; border-bottom: 2px solid #3c3c40; flex: 0 0 auto;
}
.mp-back {
    width: clamp(40px, 6.4vh, 58px); height: clamp(40px, 6.4vh, 58px);
    flex: 0 0 auto; border-radius: 50%; border: 2px solid #b9b9be; background: transparent;
    color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.mp-back:hover, .mp-back:focus { background: #333338; outline: 3px solid #fff; outline-offset: 2px; }
.mp-back svg { width: 52%; height: 52%; }
.mp-tabs { display: flex; gap: clamp(10px, 1.7vw, 30px); flex: 0 0 auto; }
.mp-tab {
    appearance: none; -webkit-appearance: none; cursor: pointer; font-family: inherit;
    padding: clamp(8px, 1.5vh, 14px) clamp(16px, 2.6vw, 42px);
    min-width: clamp(110px, 11vw, 170px); border-radius: 14px;
    border: 2px solid #6c6c72; background: transparent; color: #eee;
    font-size: clamp(14px, 2.1vh, 22px); font-weight: 600;
}
.mp-tab:hover, .mp-tab:focus { border-color: #cfcfd4; outline: 3px solid #fff; outline-offset: 2px; }
.mp-tab.on { background: #a50000; border-color: #a50000; color: #fff; }
.mp-tab.bein-sports { border-color: #8b5cf6; color: #e9d5ff; }
.mp-tab.bein-sports.on { background: linear-gradient(135deg, #7e22ce, #4c1d95); border-color: #c084fc; color: #fff; }
#mediaPage.sports-mode .mp-top { background: linear-gradient(90deg, #160a20, #241033); border-bottom-color: #7e22ce; }
.mp-tab { position: relative; overflow: hidden; }
.mp-tab > span { position: relative; z-index: 1; }
.mp-tab::after {
    content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: var(--p, 0%);
    background: linear-gradient(90deg, #e10600, #ff5a00);
    opacity: 0; transition: width .35s ease, opacity .2s;
    pointer-events: none; z-index: 0;
}
.mp-tab.refreshing::after, .mp-tab.done::after, .mp-tab.tone::after { opacity: 1; }
.mp-tab.refreshing { border-color: #ff6a3d; animation: mp-tab-pulse 1.2s ease-in-out infinite; }
.mp-tab.done { border-color: #23c55e; }
.mp-tab.done::after { background: linear-gradient(90deg, #128a3c, #23c55e); }
.mp-tab.tone { border-color: #e0a800; }
.mp-tab.tone::after { background: linear-gradient(90deg, #9a6a00, #e0a800); }
@keyframes mp-tab-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 90, 0, 0); } 50% { box-shadow: 0 0 14px 2px rgba(255, 90, 0, .55); } }
.mp-order { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.mp-order-ico { color: #e6e6ea; font-size: clamp(18px, 2.6vh, 26px); line-height: 1; }
.mp-order select {
    appearance: none; -webkit-appearance: none; font-family: inherit; cursor: pointer;
    background: #242427; color: #f0f0f2; border: 2px solid #4a4a50; border-radius: 10px;
    padding: clamp(8px, 1.3vh, 12px) clamp(28px, 3vw, 42px) clamp(8px, 1.3vh, 12px) clamp(12px, 1.6vw, 20px);
    font-size: clamp(12px, 1.8vh, 17px);
    background-image: linear-gradient(45deg, transparent 50%, #cfcfd4 50%), linear-gradient(135deg, #cfcfd4 50%, transparent 50%);
    background-position: calc(100% - 18px) 55%, calc(100% - 11px) 55%;
    background-size: 7px 7px, 7px 7px; background-repeat: no-repeat;
}
.mp-order select:focus { outline: 3px solid #fff; outline-offset: 2px; }
.mp-refresh {
    flex: 0 0 auto; width: clamp(40px, 6.4vh, 58px); height: clamp(40px, 6.4vh, 58px);
    border-radius: 50%; border: 2px solid #b9b9be; background: transparent; color: #fff;
    font-size: clamp(16px, 2.4vh, 24px); line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.mp-refresh:hover:not(:disabled), .mp-refresh:focus { background: #333338; outline: 3px solid #fff; outline-offset: 2px; }
.mp-refresh:disabled { opacity: .7; cursor: default; }
.mp-refresh.busy { animation: mp-spin 1s linear infinite; }
@keyframes mp-spin { to { transform: rotate(360deg); } }
.mp-body { display: flex; flex: 1 1 auto; min-height: 0; }
.mp-side {
    width: clamp(250px, 20.5vw, 400px); flex: 0 0 auto; overflow-y: auto;
    background: #252527; border-right: 2px solid #3c3c40;
    padding: 10px clamp(10px, 1.2vw, 18px) 18px;
}
.mp-search { position: sticky; top: 0; z-index: 2; background: #252527; padding: 2px 0 10px; }
.mp-search input {
    width: 100%; box-sizing: border-box; font-family: inherit;
    padding: clamp(10px, 1.7vh, 15px) 14px clamp(10px, 1.7vh, 15px) 42px;
    border-radius: 12px; border: 2px solid #85858b; background: #1a1a1c; color: #fff;
    font-size: clamp(13px, 1.9vh, 17px);
}
.mp-search input:focus { outline: 3px solid #fff; outline-offset: 1px; border-color: #b9b9be; }
.mp-search-ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-size: 15px; opacity: .8; pointer-events: none; }
.mp-cat {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    width: 100%; box-sizing: border-box; margin: 7px 0; padding: clamp(8px, 1.35vh, 12px) 14px;
    border: 0; border-radius: 7px; background: #323235; color: #ececef;
    font-family: inherit; font-size: clamp(13px, 1.9vh, 18px); text-align: left; cursor: pointer;
    white-space: nowrap; overflow: hidden;
}
.mp-cat span:first-child { overflow: hidden; text-overflow: ellipsis; }
.mp-cat .mp-count { flex: 0 0 auto; color: #c9c9cf; font-size: .9em; }
.mp-cat.sel { background: #8a0d0d; color: #fff; font-weight: 600; }
.mp-cat.sel .mp-count { color: #ffd9d9; }
.mp-cat:focus { outline: 3px solid #fff; outline-offset: -3px; }
.mp-main { flex: 1 1 auto; min-width: 0; overflow-y: auto; padding: clamp(12px, 1.8vh, 24px) clamp(14px, 2vw, 30px) 40px; }
.mp-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: clamp(12px, 1.4vw, 26px); }
.mp-card {
    position: relative; border-radius: 9px; overflow: hidden; background: #111114;
    border: 3px solid transparent; cursor: pointer; outline: none;
    transition: border-color .1s, transform .1s, box-shadow .1s;
}
.mp-card.sel, .mp-card:focus { border-color: #ff2b2b; box-shadow: 0 0 0 2px rgba(255,43,43,.35); }
.mp-card:hover { border-color: #d7d7dc; }
.mp-art { position: relative; aspect-ratio: 2 / 3; background: #0b0b0d; overflow: hidden; }
.mp-art img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; }
.mp-card.live .mp-art { aspect-ratio: 1; background: linear-gradient(145deg, #151519, #0b0b0d); }
.mp-card.live .mp-art img { object-fit: contain; padding: clamp(10px, 1.5vw, 22px); }
.mp-card.live .mp-fallback { font-size: clamp(24px, 3.2vh, 38px); }
.mp-fallback { position: absolute; inset: 0; z-index: 0; display: flex; align-items: center; justify-content: center; color: #56565e; font-size: clamp(30px, 4vh, 48px); font-weight: 700; }
.mp-rate {
    position: absolute; z-index: 2; top: 7px; left: 7px;
    background: #2356b8; color: #fff; font-size: clamp(11px, 1.45vh, 14px); font-weight: 700;
    padding: 2px 8px; border-radius: 7px; line-height: 1.5;
}
.mp-rate.mp-live { background: #c00000; letter-spacing: .6px; }
.mp-name {
    background: #f2f2f2; color: #101012; font-weight: 600;
    font-size: clamp(12px, 1.65vh, 16px); padding: 7px 8px; text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mp-note { padding: 60px 20px; text-align: center; color: #a4a4ac; font-size: clamp(14px, 2vh, 18px); }
.mp-note[hidden] { display: none; }
@media (max-width: 1500px) { .mp-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 1250px) { .mp-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1000px) { .mp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .mp-side { width: 220px; } }
@media (max-width: 1100px) and (min-width: 761px) {
    .mp-top { gap: 10px; }
    .mp-tabs { gap: 10px; }
    .mp-tab { min-width: 88px; padding: 9px 16px; }
}
@media (max-width: 760px) {
    .mp-top { flex-wrap: wrap; gap: 8px; }
    .mp-order { margin-left: auto; }
    .mp-tabs { order: 3; flex: 1 1 100%; justify-content: center; gap: 6px; min-width: 0; }
    .mp-tab { min-width: 0; flex: 1 1 0; padding: 8px 6px; font-size: 13px; border-radius: 10px; }
    .mp-back { width: 38px; height: 38px; }
    .mp-side { width: 190px; }
    .mp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .mp-name { font-size: 11px; }
}

/* ---- زر العودة في شاشة تغيير قائمة التشغيل + مخزن أدوات قديمة ---- */
.lg-back {
    position: fixed; top: 16px; left: 16px; right: auto; z-index: 5;
    width: clamp(40px, 6.4vh, 58px); height: clamp(40px, 6.4vh, 58px);
    border-radius: 50%; border: 2px solid #b9b9be; background: transparent;
    color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.lg-back:hover, .lg-back:focus { background: #333338; border-color: #cfcfd4; outline: 3px solid #fff; outline-offset: 2px; }
.lg-back svg { width: 52%; height: 52%; }
.lg-servers { margin: 16px 0 4px; padding-top: 14px; border-top: 1px solid #2a2a33; text-align: start; }
.lg-servers summary { list-style: none; cursor: pointer; }
.lg-servers summary::-webkit-details-marker { display: none; }
.lg-servers-title {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    font-size: 14px; font-weight: 600; color: #e5e7eb; padding: 4px 2px;
}
.lg-servers-title::after {
    content: '▾'; font-size: 12px; color: #9ca3af; transition: transform .15s;
}
.lg-servers[open] .lg-servers-title::after { transform: rotate(180deg); }
.lg-servers-title:hover { color: #fff; }
.lg-servers-title:focus-visible { color: #fff; outline: 2px solid #f6c445; outline-offset: 2px; border-radius: 6px; }
.lg-servers[open] #lgSrvList { margin-top: 8px; }
.lg-servers #lgSrvList { max-height: 160px; overflow-y: auto; }
.lg-servers button {
    display: block; width: 100%; text-align: start; direction: ltr;
    padding: 10px 12px; margin: 6px 0; background: #1a1a20; border: 1px solid #2d2d36;
    border-radius: 8px; color: #fff; font-family: inherit; font-size: 13px; cursor: pointer;
}
.lg-servers button:hover, .lg-servers button:focus { border-color: #f6c445; outline: 2px solid #f6c445; outline-offset: 1px; }
#legacyDock { display: none; }
#legacyDock #serverFileBox { margin-top: 10px; }
#legacyDock .proxy-box { margin-top: 10px; }
#dlgBody #serverFileBox label, #dlgBody #proxyBox summary { color: #e5e7eb; }

/* ---- هواتف (وضع طولي): تخطيط عمودي مريح للمس ---- */
@media (max-width: 760px) and (orientation: portrait) {
    .tv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .tv-foot { display: none; }
    .tv-tile { height: clamp(68px, 11vh, 112px); gap: clamp(5px, 1vh, 9px); padding: 8px; }
    .tv-ico { width: clamp(26px, 4vh, 40px); height: clamp(26px, 4vh, 40px); }
    .tv-label { font-size: clamp(11px, 1.7vh, 16px); }
    .strip-card { width: clamp(72px, 12vh, 108px); }
    .mp-body { flex-direction: column; }
    .mp-side {
        width: 100%; max-height: 40vh; box-sizing: border-box;
        border-right: 0; border-bottom: 2px solid #3c3c40;
    }
    .mp-main { padding-top: 10px; }
    .mp-grid { gap: 9px; }
    .watch-media { flex-direction: column; align-items: stretch; }
    .watch-poster { display: block; width: min(240px, 70vw); margin: 8px auto 0; }
    .watch-poster img { aspect-ratio: 3 / 4; }
    .watch-summary { max-height: 200px; }
}

/* ---- إعلان اكتمال تحديث القوائم ---- */
#refreshDoneNote {
    position: fixed; left: 50%; top: 12vh; z-index: 120;
    transform: translateX(-50%) translateY(-12px) scale(.96);
    padding: 15px 36px; border-radius: 14px; border: 2px solid #6ee7a0;
    background: linear-gradient(135deg, #0c6d2c, #1fae4a); color: #fff;
    font-size: clamp(16px, 2.6vh, 24px); font-weight: 700; text-align: center;
    box-shadow: 0 12px 44px rgba(0, 0, 0, .55);
    opacity: 0; pointer-events: none;
    transition: opacity .25s, transform .25s;
}
#refreshDoneNote.show { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); animation: rd-flash .9s ease-in-out 3; }
#refreshDoneNote.fail { background: linear-gradient(135deg, #7a5200, #c08a00); border-color: #ffd266; }
@keyframes rd-flash {
    0%, 100% { filter: brightness(1); box-shadow: 0 12px 44px rgba(0, 0, 0, .55); }
    50% { filter: brightness(1.8); box-shadow: 0 0 70px 10px rgba(80, 255, 150, .6); }
}

/* ---- شاشة الإنترو (فيديو أفقي 16:9) ---- */
#introScreen {
    position: fixed; inset: 0; z-index: 200; overflow: hidden; cursor: pointer;
    background: radial-gradient(120% 90% at 50% 45%, #0d1b26 0%, #04070a 62%, #000 100%);
    opacity: 0; transition: opacity .45s ease;
}
#introScreen.show { opacity: 1; }
#introScreen[hidden] { display: none; }
.intro-zoom { position: absolute; inset: 0; }
#introVideo {
    position: absolute; top: 50%; left: 50%;
    width: 100%; height: 100%;
    transform: translate(-50%, -50%);
    object-fit: contain; pointer-events: none;
}
.intro-shade {
    position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(125% 105% at 50% 50%, transparent 62%, rgba(0,0,0,.42) 100%);
}
.intro-ctl { position: absolute; top: 18px; left: 18px; display: flex; gap: 10px; }
.intro-btn {
    appearance: none; -webkit-appearance: none; font-family: inherit; cursor: pointer;
    padding: 9px 16px; border-radius: 999px; border: 2px solid rgba(255,255,255,.55);
    background: rgba(0,0,0,.45); color: #fff; font-size: 15px; font-weight: 600;
    backdrop-filter: blur(4px);
}
.intro-btn:hover, .intro-btn:focus { background: rgba(0,0,0,.75); border-color: #fff; outline: 3px solid #ffd166; outline-offset: 2px; }
.intro-mute { padding: 9px 12px; }
.intro-progress {
    position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
    background: rgba(255,255,255,.14);
}
.intro-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #1fae4a, #ffd166); transition: width .2s linear; }
@media (max-width: 760px) {
    .intro-ctl { top: 12px; left: 12px; }
    .intro-btn { padding: 7px 13px; font-size: 13px; }
}

/* ---- مبدّل السيرفر العام + البحث في كل السيرفرات (2026-11-24) ---- */
#srvFab {
    position: fixed; left: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 150;
    display: inline-flex; align-items: center; justify-content: center; gap: 0;
    width: 38px; height: 38px; padding: 0; box-sizing: border-box; border-radius: 50%;
    border: 1px solid #e50914; background: rgba(12,12,14,.92); color: #fff;
    font-family: inherit; font-size: 0; cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,.45); backdrop-filter: blur(6px);
}
#srvFab:hover, #srvFab:focus { outline: 2px solid #ffd166; outline-offset: 2px; border-color: #ff4b55; }
#srvFab .srv-fab-ico { font-size: 17px; line-height: 1; }
#srvFabLabel { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
body.login-mode #srvFab, #srvFab[hidden] { display: none; }
body.media-mode .mp-main { padding-bottom: 64px; }
body.watching .watch-body { padding-bottom: 64px; }
#srvSheet {
    position: fixed; left: 14px; bottom: 64px; z-index: 151;
    width: min(360px, calc(100vw - 28px)); max-height: min(62vh, 520px);
    display: flex; flex-direction: column;
    background: #141417; border: 1px solid #3a3a42; border-radius: 14px;
    box-shadow: 0 18px 50px rgba(0,0,0,.65); overflow: hidden;
}
#srvSheet[hidden] { display: none; }
.srv-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid #2d2d35; }
.srv-sheet-head b { font-size: 15px; }
.srv-sheet-head button { border: 0; background: #26262c; color: #fff; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 15px; }
.srv-sheet-note { padding: 9px 14px 4px; color: #a1a1aa; font-size: 12px; line-height: 1.6; }
.srv-sheet-actions { padding: 7px 12px; border-bottom: 1px solid #2d2d35; background: #19191e; }
.srv-sheet-actions button { width: 100%; padding: 8px 10px; border: 1px solid #3f6f47; border-radius: 8px; background: #1d4027; color: #e9f7ec; font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.srv-sheet-actions button:hover:not(:disabled), .srv-sheet-actions button:focus { outline: 2px solid #7ee2a8; outline-offset: 1px; background: #285a35; }
.srv-sheet-actions button:disabled { opacity: .45; cursor: not-allowed; }
#srvSheetList { overflow-y: auto; padding: 8px 10px 12px; }
.srv-sheet-item { margin: 6px 0; }
.srv-sheet-row {
    display: flex; align-items: center; gap: 9px; width: 100%; box-sizing: border-box;
    margin: 0; padding: 10px 12px; border-radius: 9px;
    border: 1px solid #34343c; background: #1d1d22; color: #fff;
    font-family: inherit; font-size: 13px; text-align: start; cursor: pointer;
}
.srv-sheet-item .srv-sheet-row { border-radius: 9px 9px 0 0; }
.srv-sheet-row:hover, .srv-sheet-row:focus { background: #26262d; outline: 2px solid #ffd166; outline-offset: 1px; }
.srv-sheet-row.cur { border-color: #f6c445; background: #211d10; }
.srv-dot { flex: 0 0 auto; font-size: 12px; }
.srv-sheet-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: start; }
.srv-sheet-extra { flex: 0 0 auto; color: #c9c9cf; font-size: 11px; }
.srv-rating { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid #34343c; border-top: 0; border-radius: 0 0 9px 9px; background: #17171c; }
.srv-rating-label { flex: 1 1 auto; color: #8f8f99; font-size: 10px; }
.srv-rate { min-width: 58px; padding: 5px 8px; border: 1px solid #45454e; border-radius: 7px; background: #24242b; color: #d7d7df; font-family: inherit; font-size: 11px; font-weight: 600; cursor: pointer; }
.srv-rate:hover, .srv-rate:focus { outline: 2px solid #ffd166; outline-offset: 1px; }
.srv-rate.good.active { border-color: #4c9a60; background: #1d4027; color: #b9f0c6; }
.srv-rate.bad.active { border-color: #a84b55; background: #4a1d24; color: #ffc4ca; }
.mp-x-toggle {
    display: flex; align-items: center; gap: 8px; margin: 0 0 8px;
    padding: 9px 12px; border-radius: 10px; background: #1a1a1c; border: 2px solid #3c3c40;
    color: #ececef; font-size: 13px; cursor: pointer; user-select: none;
}
.mp-x-toggle input { width: auto; margin: 0; accent-color: #e50914; }
.mp-x-toggle:has(input:checked) { border-color: #e50914; background: #241114; }
.mp-x-toggle[hidden] { display: none; }
.mp-x-note { margin: 0 0 10px; padding: 8px 10px; border-radius: 8px; background: #1b1b20; color: #ffd166; font-size: 12px; line-height: 1.6; }
.mp-x-note[hidden] { display: none; }
.mp-srv {
    position: absolute; z-index: 2; top: 7px; right: 7px;
    background: rgba(0,0,0,.78); color: #ff8a8a; border: 1px solid #7a2626;
    font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 6px; line-height: 1.5;
}
.mp-srv.cur { color: #7ee2a0; border-color: #256b3a; }
@media (max-width: 760px) {
    #srvFab { width: 36px; height: 36px; left: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
    #srvFab .srv-fab-ico { font-size: 16px; }
    #srvSheet { left: 10px; bottom: calc(56px + env(safe-area-inset-bottom, 0px)); width: min(340px, calc(100vw - 20px)); }
    .mp-x-toggle { font-size: 12px; }
}
