:root {
    --bg: #08111f;
    --panel: rgba(15, 25, 43, .88);
    --panel2: rgba(18, 31, 53, .72);
    --line: rgba(148, 163, 184, .16);
    --text: #e9f3ff;
    --muted: #91a3bd;
    --brand: #20d7b5;
    --brand2: #38bdf8;
    --danger: #fb7185;
    --warning: #fbbf24;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(32, 215, 181, .16), transparent 34rem),
        radial-gradient(circle at top right, rgba(56, 189, 248, .14), transparent 32rem),
        linear-gradient(135deg, #060b14, #0b1526 42%, #101827);
    font-family: Manrope, Cairo, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
}
body.rtl {
    font-family: Cairo, Manrope, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
}

a { color: inherit; text-decoration: none; }
.auth-shell, .install-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 30px;
}
.card {
    width: min(1040px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 28px;
    padding: 26px;
    box-shadow: 0 28px 80px rgba(0,0,0,.35);
    backdrop-filter: blur(18px);
}
.narrow { width: min(460px, 100%); }
h1, h2, h3 { margin: 0 0 14px; line-height: 1.1; }
p { color: var(--muted); line-height: 1.65; }
.layout { display: grid; grid-template-columns: 270px 1fr; min-height: 100vh; }
.sidebar {
    padding: 22px;
    border-right: 1px solid var(--line);
    background:
        radial-gradient(circle at 20% 8%, rgba(32, 215, 181, .16), transparent 18rem),
        linear-gradient(180deg, rgba(5, 10, 20, .82), rgba(8, 17, 31, .58));
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    font-weight: 900;
    letter-spacing: -.03em;
    font-size: 22px;
}
.brand span { display: block; }
.brand small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.45;
}
.brand::before {
    content: '';
    width: 38px;
    height: 38px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--brand), var(--brand2));
    box-shadow: 0 12px 24px rgba(32, 215, 181, .2);
}
.nav { display: grid; gap: 8px; }
.nav a {
    padding: 12px 14px;
    border-radius: 16px;
    color: var(--muted);
    font-weight: 800;
}
.nav a:hover, .nav a.active {
    color: var(--text);
    background:
        linear-gradient(135deg, rgba(32,215,181,.14), rgba(56,189,248,.09)),
        rgba(255,255,255,.06);
    box-shadow: inset 0 0 0 1px rgba(148,163,184,.12);
}
.sidebar-user { margin-top: 24px; }
.main { padding: 28px; }
.topbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 22px;
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.language-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(2,6,23,.32);
}
.language-switch a {
    padding: 8px 11px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}
.language-switch a.active {
    color: #031019;
    background: linear-gradient(135deg, var(--brand), var(--brand2));
}
.language-switch.compact a { padding: 7px 10px; }
.between {
    justify-content: space-between;
    width: 100%;
}
.grid { display: grid; gap: 18px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat, .panel {
    background: var(--panel2);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 20px;
    box-shadow: 0 18px 48px rgba(0,0,0,.16);
}
.panel {
    background:
        linear-gradient(180deg, rgba(18,31,53,.80), rgba(10,20,35,.68)),
        radial-gradient(circle at top right, rgba(56,189,248,.08), transparent 22rem);
}
.stat strong { display: block; font-size: 32px; margin-top: 8px; }
.muted { color: var(--muted); }
label { display: grid; gap: 7px; color: #bed0e8; font-weight: 800; font-size: 13px; margin-bottom: 12px; }
label:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
    gap: 10px;
}
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
}
input, textarea, select {
    width: 100%;
    border: 1px solid rgba(148,163,184,.22);
    background: rgba(2,6,23,.42);
    color: var(--text);
    border-radius: 14px;
    padding: 12px 13px;
    outline: none;
}
textarea { min-height: 180px; resize: vertical; }
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 14px;
    padding: 11px 15px;
    color: #031019;
    background: linear-gradient(135deg, var(--brand), var(--brand2));
    font-weight: 900;
    cursor: pointer;
}
.btn.secondary, button.secondary { color: var(--text); background: rgba(255,255,255,.08); border: 1px solid var(--line); }
.btn.danger, button.danger { color: #fff; background: linear-gradient(135deg, #ef4444, #be123c); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 10px; border-bottom: 1px solid rgba(148,163,184,.12); text-align: left; vertical-align: top; }
th { color: #9bb0ca; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.rtl th, .rtl td { text-align: right; }
.rtl .copy-input, .rtl input[type="url"], .rtl input[name*="url"], .rtl input[name*="path"], .rtl textarea[name="allowed_domains"] {
    direction: ltr;
    text-align: left;
}
.rtl .actions { direction: rtl; }
.rtl .player-card, .rtl video { direction: ltr; }
.install-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 18px;
}
.flash { padding: 12px 14px; border-radius: 16px; margin: 0 0 16px; background: rgba(32, 215, 181, .13); border: 1px solid rgba(32, 215, 181, .24); }
.error { background: rgba(251, 113, 133, .13); border-color: rgba(251, 113, 133, .24); }
.player-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.player-wrap { width: min(1100px, 100%); }
.player-card { position: relative; background: #000; border-radius: 26px; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 30px 90px rgba(0,0,0,.45); }
video { width: 100%; display: block; background: #000; }
.center-live-play {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 8;
    display: grid;
    place-items: center;
    width: clamp(86px, 13vw, 132px);
    aspect-ratio: 1;
    padding: 0;
    color: #031019;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    transform: translate(-50%, -50%) scale(1);
    background:
        radial-gradient(circle at 35% 25%, rgba(255,255,255,.68), transparent 18%),
        linear-gradient(135deg, #67e8f9, #2dd4bf 46%, #22c55e);
    box-shadow:
        0 0 0 12px rgba(45,212,191,.10),
        0 0 0 26px rgba(56,189,248,.06),
        0 28px 80px rgba(0,0,0,.42),
        0 0 52px rgba(45,212,191,.42);
    transition: opacity .22s ease, visibility .22s ease, transform .22s ease, filter .22s ease;
}
.center-live-play:hover {
    filter: saturate(1.08) brightness(1.05);
    transform: translate(-50%, -50%) scale(1.045);
}
.center-live-play:active {
    transform: translate(-50%, -50%) scale(.96);
}
.center-live-play.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(.82);
}
.center-live-play__pulse,
.center-live-play__ring,
.center-live-play__icon {
    pointer-events: none;
}
.center-live-play__pulse,
.center-live-play__ring {
    position: absolute;
    inset: -18px;
    border-radius: inherit;
    border: 2px solid rgba(125,211,252,.36);
}
.center-live-play__pulse {
    animation: centerPlayPulse 1.85s ease-out infinite;
}
.center-live-play__ring {
    inset: -7px;
    border-top-color: rgba(255,255,255,.82);
    border-right-color: rgba(34,211,238,.74);
    border-bottom-color: rgba(45,212,191,.16);
    border-left-color: rgba(34,197,94,.24);
    animation: centerPlaySpin 2.2s linear infinite;
}
.center-live-play__icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 54%;
    aspect-ratio: 1;
    border-radius: 999px;
    background: rgba(255,255,255,.34);
    box-shadow: inset 0 0 18px rgba(255,255,255,.24);
}
.center-live-play__icon svg {
    width: 72%;
    height: 72%;
    fill: currentColor;
    transform: translateX(5%);
}
.center-live-play.is-busy .center-live-play__ring {
    animation-duration: .72s;
}
@keyframes centerPlayPulse {
    0% { opacity: .76; transform: scale(.88); }
    80%, 100% { opacity: 0; transform: scale(1.42); }
}
@keyframes centerPlaySpin {
    to { transform: rotate(360deg); }
}
.startup-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at center, rgba(32,215,181,.18), transparent 22rem),
        linear-gradient(180deg, rgba(2,6,23,.72), rgba(2,6,23,.92));
    color: var(--text);
    transition: opacity .35s ease, visibility .35s ease;
    pointer-events: none;
}
.startup-overlay.is-hidden { opacity: 0; visibility: hidden; }
.sound-overlay {
    position: absolute;
    inset: 0;
    z-index: 8;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, rgba(0,0,0,.08), rgba(0,0,0,.24));
    transition: opacity .25s ease, visibility .25s ease;
    pointer-events: auto;
}
.sound-overlay.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.sound-button {
    display: grid;
    justify-items: center;
    gap: 7px;
    min-width: 190px;
    padding: 18px 22px;
    color: #031019;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--brand), var(--brand2));
    box-shadow: 0 18px 55px rgba(32,215,181,.28), 0 0 0 8px rgba(255,255,255,.08);
}
.sound-button strong { font-size: 16px; }
.sound-button small { color: rgba(3,16,25,.76); font-weight: 900; }
.sound-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255,255,255,.36);
    font-size: 12px;
    font-weight: 1000;
    letter-spacing: .04em;
}
.startup-box {
    width: min(360px, calc(100% - 40px));
    display: grid;
    justify-items: center;
    gap: 12px;
    padding: 22px;
    border: 1px solid rgba(148,163,184,.18);
    border-radius: 24px;
    background: rgba(5,10,20,.72);
    box-shadow: 0 24px 70px rgba(0,0,0,.42);
    backdrop-filter: blur(16px);
    text-align: center;
}
.startup-box strong { font-size: 18px; letter-spacing: -.02em; }
.startup-box span { color: var(--muted); font-size: 13px; }
.startup-spinner {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,.14);
    border-top-color: var(--brand);
    animation: spin .8s linear infinite;
}
.startup-meter {
    width: 100%;
    height: 7px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(148,163,184,.18);
}
.startup-meter i {
    display: block;
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand), var(--brand2));
    transition: width .25s ease;
}
.startup-overlay {
    background:
        radial-gradient(circle at 20% 15%, rgba(34,211,238,.22), transparent 22rem),
        radial-gradient(circle at 82% 78%, rgba(16,185,129,.20), transparent 24rem),
        linear-gradient(135deg, rgba(2,6,23,.78), rgba(3,7,18,.95));
}
.startup-overlay::before,
.startup-overlay::after {
    content: "";
    position: absolute;
    inset: 10%;
    border-radius: 999px;
    border: 1px solid rgba(45,212,191,.16);
    filter: blur(.2px);
    animation: livePulse 2.6s ease-in-out infinite;
}
.startup-overlay::after {
    inset: 20%;
    border-color: rgba(56,189,248,.15);
    animation-delay: .55s;
}
.startup-box {
    position: relative;
    z-index: 1;
    width: min(460px, calc(100% - 34px));
    gap: 13px;
    padding: 28px;
    border-color: rgba(125,211,252,.22);
    background:
        linear-gradient(180deg, rgba(15,23,42,.86), rgba(2,6,23,.80)),
        radial-gradient(circle at top, rgba(45,212,191,.22), transparent 18rem);
    box-shadow: 0 34px 100px rgba(0,0,0,.52), 0 0 70px rgba(45,212,191,.14);
}
.startup-orbit {
    position: relative;
    display: grid;
    place-items: center;
    width: 86px;
    height: 86px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(45,212,191,.24), rgba(14,165,233,.08) 54%, transparent 56%);
}
.startup-orbit i {
    position: absolute;
    inset: 6px;
    border-radius: inherit;
    border: 2px solid rgba(255,255,255,.14);
    border-top-color: var(--brand);
    border-left-color: var(--brand2);
    animation: spin 1.25s linear infinite;
}
.startup-orbit b {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    color: #04111f;
    background: linear-gradient(135deg, var(--brand), var(--brand2));
    font-size: 12px;
    letter-spacing: .08em;
    box-shadow: 0 0 28px rgba(45,212,191,.35);
}
.startup-eyebrow {
    margin: 0;
    color: #7dd3fc;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: .02em;
}
.startup-box strong {
    font-size: clamp(20px, 3vw, 28px);
    line-height: 1.25;
}
.startup-box span {
    max-width: 34rem;
    color: rgba(226,232,240,.78);
    font-size: 14px;
    line-height: 1.8;
}
.startup-count {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 8px 14px;
    border: 1px solid rgba(148,163,184,.18);
    border-radius: 999px;
    background: rgba(15,23,42,.62);
}
.startup-count b {
    color: #67e8f9;
    font-size: 22px;
    line-height: 1;
}
.startup-count small {
    color: rgba(226,232,240,.66);
    font-weight: 800;
}
.startup-box em {
    color: rgba(148,163,184,.78);
    font-size: 12px;
    font-style: normal;
}
.startup-meter {
    height: 9px;
    background: rgba(15,23,42,.82);
    box-shadow: inset 0 0 0 1px rgba(148,163,184,.14);
}
.startup-meter i {
    background: linear-gradient(90deg, #22c55e, #22d3ee, #60a5fa);
    box-shadow: 0 0 22px rgba(34,211,238,.45);
}
@keyframes livePulse {
    0%, 100% { transform: scale(.96); opacity: .36; }
    50% { transform: scale(1.04); opacity: .82; }
}
@keyframes spin { to { transform: rotate(360deg); } }
.live-preloader {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: grid;
    place-items: center;
    overflow: hidden;
    pointer-events: none;
    background:
        radial-gradient(circle at 50% 50%, rgba(45,212,191,.18), transparent 15rem),
        radial-gradient(circle at 25% 18%, rgba(56,189,248,.15), transparent 18rem),
        radial-gradient(circle at 78% 72%, rgba(34,197,94,.12), transparent 20rem),
        linear-gradient(180deg, rgba(0,0,0,.16), rgba(0,0,0,.38));
    transition: opacity .35s ease, visibility .35s ease;
}
.live-preloader.is-hidden {
    opacity: 0;
    visibility: hidden;
}
.live-preloader::before,
.live-preloader::after {
    content: "";
    position: absolute;
    width: min(48rem, 120vw);
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px solid rgba(125,211,252,.12);
    animation: liveSignalBloom 3.4s ease-out infinite;
}
.live-preloader::after {
    width: min(34rem, 92vw);
    border-color: rgba(45,212,191,.14);
    animation-delay: 1.1s;
}
.live-preloader__stage {
    position: relative;
    width: min(210px, 42vw);
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    filter: drop-shadow(0 0 30px rgba(34,211,238,.34));
}
.live-preloader__rings,
.live-preloader__rings i,
.live-preloader__core,
.live-preloader__waves,
.live-preloader__waves i {
    position: absolute;
    inset: 0;
    border-radius: 50%;
}
.live-preloader__rings {
    border: 1px solid rgba(255,255,255,.08);
    animation: liveRingTurn 7s linear infinite;
}
.live-preloader__rings i {
    border: 2px solid transparent;
    border-top-color: rgba(34,211,238,.92);
    border-right-color: rgba(45,212,191,.54);
    animation: liveRingTurn 1.35s linear infinite;
}
.live-preloader__rings i:nth-child(2) {
    inset: 13%;
    border-top-color: rgba(96,165,250,.86);
    border-left-color: rgba(34,197,94,.44);
    animation-duration: 1.95s;
    animation-direction: reverse;
}
.live-preloader__rings i:nth-child(3) {
    inset: 27%;
    border-top-color: rgba(187,247,208,.92);
    border-bottom-color: rgba(125,211,252,.28);
    animation-duration: 1.12s;
}
.live-preloader__core {
    inset: 33%;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 35% 28%, rgba(255,255,255,.42), transparent 15%),
        linear-gradient(135deg, #22d3ee, #2dd4bf 46%, #22c55e);
    box-shadow:
        inset 0 0 18px rgba(255,255,255,.22),
        0 0 0 10px rgba(34,211,238,.08),
        0 0 42px rgba(45,212,191,.52);
    animation: liveCoreBeat 1.55s ease-in-out infinite;
}
.live-preloader__core b,
.live-preloader__core span {
    position: absolute;
    display: block;
    border-radius: 50%;
}
.live-preloader__core b {
    width: 18%;
    aspect-ratio: 1;
    background: rgba(2,6,23,.82);
    box-shadow: 0 0 16px rgba(2,6,23,.26);
}
.live-preloader__core span {
    width: 62%;
    aspect-ratio: 1;
    border: 2px solid rgba(2,6,23,.5);
    border-left-color: transparent;
    border-bottom-color: transparent;
    animation: liveRingTurn .8s linear infinite;
}
.live-preloader__waves i {
    inset: 42%;
    border: 1px solid rgba(125,211,252,.4);
    animation: liveWave 2.55s ease-out infinite;
}
.live-preloader__waves i:nth-child(2) { animation-delay: .45s; border-color: rgba(45,212,191,.36); }
.live-preloader__waves i:nth-child(3) { animation-delay: .9s; border-color: rgba(34,197,94,.28); }
.live-preloader__waves i:nth-child(4) { animation-delay: 1.35s; border-color: rgba(96,165,250,.25); }
.live-preloader__bar {
    position: absolute;
    left: 13%;
    right: 13%;
    bottom: -18%;
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(15,23,42,.72);
    box-shadow: inset 0 0 0 1px rgba(148,163,184,.16);
}
.live-preloader__bar i {
    display: block;
    width: 8%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #22c55e, #22d3ee, #60a5fa);
    box-shadow: 0 0 18px rgba(34,211,238,.48);
    transition: width .3s ease;
}
@keyframes liveRingTurn {
    to { transform: rotate(360deg); }
}
@keyframes liveCoreBeat {
    0%, 100% { transform: scale(.94); }
    45% { transform: scale(1.08); }
}
@keyframes liveWave {
    0% { transform: scale(.25); opacity: .92; }
    80%, 100% { transform: scale(1.85); opacity: 0; }
}
@keyframes liveSignalBloom {
    0% { transform: scale(.62); opacity: .5; }
    100% { transform: scale(1.18); opacity: 0; }
}
.embed { padding: 0; background: #000; }
.embed .player-wrap, .embed .player-card { width: 100%; height: 100vh; border: 0; border-radius: 0; box-shadow: none; }
.embed video { height: 100vh; object-fit: contain; }
.startup-overlay,
.sound-overlay {
    display: none !important;
}
.copy-input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
@media (max-width: 920px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .main { padding: 18px; }
    .stats { grid-template-columns: 1fr; }
    .topbar, .install-head { display: grid; }
    .topbar-actions { justify-content: flex-start; }
    .rtl .topbar-actions { justify-content: flex-end; }
}
