* { box-sizing: border-box; }
html, body {
    width: 100%;
    min-height: 100%;
    margin: 0;
    background:
        radial-gradient(circle at top right, rgba(24, 119, 242, .16), transparent 28%),
        linear-gradient(180deg, #09101d 0%, #050a13 100%);
    color: #fff;
    font-family: Tahoma, Arial, sans-serif;
}
body.megaplay-player-page { direction: rtl; }
a { color: inherit; }
button { font: inherit; }
.megaplay-stage {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.vnx-entry-screen,
.vnx-shell {
    width: min(1180px, 100%);
}
.vnx-entry-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 32px 20px;
    text-align: center;
}
.vnx-entry-screen h1 {
    margin: 0;
    font-size: clamp(24px, 3.4vw, 40px);
    line-height: 1.2;
}
.vnx-entry-screen p {
    margin: 0;
    max-width: 620px;
    color: #b9c5dc;
    line-height: 1.9;
}
.vnx-entry-button {
    width: 112px;
    height: 112px;
    border: none;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    box-shadow: 0 18px 45px rgba(185, 28, 28, .45);
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
}
.vnx-entry-button:hover,
.vnx-entry-button:focus-visible {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 22px 52px rgba(185, 28, 28, .58);
    outline: none;
}
.vnx-entry-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
}
.vnx-entry-icon svg {
    width: 100%;
    height: 100%;
}
.vnx-shell {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.vnx-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.vnx-back-button {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,.1);
    background: rgba(13, 20, 34, .9);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(0,0,0,.22);
}
.vnx-back-button:hover,
.vnx-back-button:focus-visible {
    background: rgba(25, 37, 61, .95);
    outline: none;
}
.vnx-back-button svg { width: 22px; height: 22px; }
.vnx-back-button[hidden] { display: none !important; }
.vnx-mode-switcher {
    margin-inline-start: auto;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.vnx-mode-button {
    min-width: 148px;
    border: 0;
    border-radius: 14px;
    padding: 12px 18px;
    color: rgba(255,255,255,.96);
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
    opacity: .84;
}
.vnx-mode-button:hover,
.vnx-mode-button:focus-visible {
    transform: translateY(-1px);
    opacity: 1;
    outline: none;
}
.vnx-watch-button { background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%); }
.vnx-download-button { background: linear-gradient(135deg, #22c55e 0%, #15803d 100%); }
.vnx-mode-button.is-active {
    opacity: 1;
    box-shadow: 0 14px 30px rgba(0,0,0,.24);
}
.vnx-chooser,
.vnx-player-panel {
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 24px;
    background: rgba(8, 14, 25, .84);
    box-shadow: 0 22px 60px rgba(0,0,0,.28);
    backdrop-filter: blur(14px);
}
.vnx-chooser {
    padding: 24px;
}
.vnx-chooser-head {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
}
.vnx-chooser-head strong {
    font-size: 22px;
    font-weight: 700;
    font-family: monospace;
    text-align: center;
    background: #26262a5e;
    padding: 10px;
    border-radius: 15px;
}
.vnx-chooser-head span {
    color: #9eb0cb;
    line-height: 1.8;
}
.vnx-server-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.vnx-server-card {
    border: 1px solid #ffffff16;
    border-radius: 18px;
    padding: 15px 16px;
    background: #26262aa3;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: right;
    cursor: pointer;
    transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
    flex-direction: row-reverse;
    justify-content: space-between;
}
.vnx-server-card:hover,
.vnx-server-card:focus-visible {
    outline: none;
}
.vnx-server-card.is-current {
    border-color: rgba(59, 130, 246, .6);
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, .24);
}
.vnx-server-icon {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #454547;
}
.vnx-server-icon svg {
    width: 20px;
    height: 20px;
}
.vnx-server-card.is-secondary .vnx-server-icon {
    color: #d8b4fe;
    background: #454547;
}
.vnx-server-card.is-secondary .vnx-server-icon svg,
.vnx-server-card.is-secondary .vnx-server-icon svg path {
    color: inherit;
    fill: currentColor;
}
.vnx-server-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.vnx-server-copy strong {
    font-size: 15px;
    line-height: 1.55;
}
.vnx-server-copy small {
    font-size: 12px;
    color: #757576;
    direction: ltr;
    text-align: right;
}
.vnx-player-panel {
    padding: 14px;
}
.vnx-player-frame {
    position: relative;
    overflow: hidden;
    min-height: min(70vh, 760px);
    border-radius: 18px;
    background: #000;
}
#megaplay-player,
#megaplay-player > div,
#megaplay-native {
    width: 100% !important;
    height: min(70vh, 760px) !important;
}
#megaplay-native {
    display: block;
    object-fit: contain;
    background: #000;
}
.megaplay-error {
    min-height: min(70vh, 760px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 28px;
    text-align: center;
    color: #fff;
    background: radial-gradient(circle at center, #182027 0, #000 70%);
}
.megaplay-error strong { font-size: 24px; }
.megaplay-error span { max-width: 760px; line-height: 1.8; color: #cbd5e1; }
.megaplay-error .vnx-stream-diagnostic,
.megaplay-error .vnx-stream-retry {
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 9px;
    color: #fff;
    background: rgba(255,255,255,.09);
    cursor: pointer;
}
.megaplay-error .vnx-stream-diagnostic:disabled { opacity: .65; cursor: wait; }
.megaplay-error .vnx-stream-diagnostic-report {
    width: min(820px, 96%);
    min-height: 190px;
    max-height: 42vh;
    padding: 12px;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 9px;
    direction: ltr;
    text-align: left;
    resize: vertical;
    color: #dbeafe;
    background: #070b12;
    font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
}

@media (max-width: 920px) {
    .vnx-server-grid { grid-template-columns: 1fr; }
    .megaplay-stage { padding: 18px; }
}

@media (max-width: 640px) {
    .megaplay-stage { padding: 14px; }
    .vnx-entry-button { width: 92px; height: 92px; }
    .vnx-entry-icon { width: 36px; height: 36px; }
    .vnx-topbar {
        flex-direction: column;
        align-items: stretch;
    }
    .vnx-mode-switcher { margin-inline-start: 0; width: 100%; }
    .vnx-mode-button { flex: 1 1 0; min-width: 0; }
    .vnx-chooser,
    .vnx-player-panel { padding: 16px; }
    .vnx-chooser-head strong { font-size: clamp(15px, 4.5vw, 19px); padding: 7px 9px; }
    .vnx-server-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .vnx-server-card { padding: 9px; gap: 7px; border-radius: 13px; min-height: 54px; }
    .vnx-server-icon { width: 32px; height: 32px; flex-basis: 32px; border-radius: 9px; }
    .vnx-server-icon svg { width: 16px; height: 16px; }
    .vnx-server-copy strong { font-size: 12px; line-height: 1.35; }
    .vnx-server-copy small { font-size: 10px; }
    #megaplay-player,
    #megaplay-player > div,
    #megaplay-native,
    .vnx-player-frame,
    .megaplay-error {
        min-height: 54vh;
        height: 54vh !important;
    }
}

.vnx-stream-retry {
    appearance: none;
    border: 1px solid rgba(255,255,255,.28);
    border-radius: 999px;
    background: rgba(255,255,255,.1);
    color: inherit;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    margin-top: 10px;
    padding: 9px 18px;
}
.vnx-stream-retry:hover,
.vnx-stream-retry:focus-visible {
    background: rgba(255,255,255,.18);
    outline: none;
}

@media (max-width: 300px) { .vnx-server-grid { grid-template-columns: 1fr; } }
