* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0a0a0f;
    --bg2: #111118;
    --bg3: #18181f;
    --bg4: #1e1e28;
    --accent: #e8003d;
    --accent2: #ff2257;
    --tg: #229ED9;
    --text: #ffffff;
    --text2: #a0a0b8;
    --border: rgba(255, 255, 255, 0.06);
    --header-h: 64px;
    --ticker-h: 36px;
}

html,
body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Arial', sans-serif;
    height: 100%;
    overflow: hidden;
}

/* ====== HEADER ====== */
.header {
    height: var(--header-h);
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-img {
    height: 38px;
    width: auto;
    object-fit: contain;
}

.logo-text {
    font-size: 22px;
    font-weight: 900;
    letter-spacing: -0.5px;
    color: #fff;
}

.logo-live {
    color: var(--accent2);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1px;
    vertical-align: middle;
    background: rgba(232, 0, 61, .15);
    border: 1px solid var(--accent);
    padding: 2px 7px;
    border-radius: 6px;
    margin-left: 4px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.viewer-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--bg3);
    border: 1px solid var(--border);
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.viewer-num {
    font-size: 18px;
    font-weight: 900;
    color: #fff;
    min-width: 20px;
    text-align: center;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent2);
    flex-shrink: 0;
    animation: pulse 1.6s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 34, 87, .8);
    }

    70% {
        box-shadow: 0 0 0 8px rgba(255, 34, 87, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 34, 87, 0);
    }
}

.viewer-label {
    color: var(--text2);
    font-weight: 500;
    font-size: 12px;
}

.tg-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--tg);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    transition: opacity .2s, transform .1s;
    white-space: nowrap;
}

.tg-btn:hover {
    opacity: .85;
    transform: translateY(-1px);
}

/* ====== TICKER ====== */
.ticker-bar {
    height: var(--ticker-h);
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    overflow: hidden;
    flex-shrink: 0;
}

.ticker-label {
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    padding: 0 14px;
    height: 100%;
    display: flex;
    align-items: center;
    letter-spacing: 1px;
    flex-shrink: 0;
    white-space: nowrap;
}

.ticker-track {
    flex: 1;
    overflow: hidden;
    height: 100%;
    display: flex;
    align-items: center;
}

.ticker-content {
    white-space: nowrap;
    font-size: 13px;
    color: var(--text2);
    animation: ticker 30s linear infinite;
    padding-left: 20px;
}

@keyframes ticker {
    0% {
        transform: translateX(100vw);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* ====== MAIN LAYOUT ====== */
.main {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 0;
    height: calc(100vh - var(--header-h) - var(--ticker-h));
    overflow: hidden;
}

/* ====== PLAYER SIDE ====== */
.player-side {
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 12px;
    overflow: hidden;
}

.video-wrapper {
    position: relative;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    background: #000;
}

/* Center Play */
.center-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(6px);
    border: 2px solid rgba(255, 255, 255, .2);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    opacity: 1;
    transition: opacity .3s, transform .15s;
}

.center-play:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.center-play svg {
    width: 36px;
    height: 36px;
    color: #fff;
}

/* Controls Bar */
.controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(transparent, rgba(0, 0, 0, .85));
    opacity: 1;
    transition: opacity .35s;
}

.controls-left,
.controls-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ctrl-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 7px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}

.ctrl-btn:hover {
    background: rgba(255, 255, 255, .12);
}

.ctrl-btn svg {
    width: 22px;
    height: 22px;
}

/* Volume */
.vol-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
}

.vol-slider {
    -webkit-appearance: none;
    width: 70px;
    height: 3px;
    border-radius: 3px;
    background: rgba(255, 255, 255, .3);
    outline: none;
    cursor: pointer;
}

.vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
}

/* Quality */
.quality-wrap {
    position: relative;
}

.quality-btn {
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .5px;
}

.quality-btn span {
    font-size: 11px;
    font-weight: 700;
}

.quality-menu {
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    min-width: 100px;
    display: none;
}

.quality-menu.open {
    display: block;
}

.quality-menu button {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: var(--text2);
    padding: 9px 14px;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: background .15s;
}

.quality-menu button:hover,
.quality-menu button.active {
    background: var(--bg4);
    color: #fff;
}

/* Buffering Spinner */
.buffering {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .3);
}

.buffering.show {
    display: flex;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255, 255, 255, .15);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Now Playing */
.now-playing {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--bg2);
    border-radius: 12px;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.np-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent2);
    flex-shrink: 0;
    animation: pulse 1.6s infinite;
}

#nowPlayingName {
    font-size: 14px;
    font-weight: 600;
    color: var(--text2);
}

/* ====== CHANNEL SIDE ====== */
.channel-side {
    background: var(--bg2);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* sticky top part */
.category-tabs,
.search-wrap {
    flex-shrink: 0;
}

.category-tabs {
    display: flex;
    gap: 6px;
    padding: 14px 14px 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

.cat-tab {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text2);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all .2s;
}

.cat-tab:hover {
    background: var(--bg4);
    color: #fff;
}

.cat-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.search-wrap {
    position: relative;
    padding: 12px 14px;
}

.search-icon {
    position: absolute;
    left: 26px;
    top: 50%;
    transform: translateY(-50%);
    margin-top: 0;
    width: 18px;
    height: 18px;
    color: var(--text2);
    pointer-events: none;
}

#search {
    width: 100%;
    padding: 11px 14px 11px 40px;
    border: 1px solid var(--border);
    outline: none;
    border-radius: 12px;
    background: var(--bg3);
    color: #fff;
    font-size: 14px;
    transition: border-color .2s;
}

#search:focus {
    border-color: rgba(255, 255, 255, .2);
}

#search::placeholder {
    color: var(--text2);
}

/* Channel Grid — scrollable */
.channel-grid {
    flex: 1;
    overflow-y: auto;
    padding: 0 14px 80px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    align-content: start;
}

.channel-grid::-webkit-scrollbar {
    width: 4px;
}

.channel-grid::-webkit-scrollbar-track {
    background: transparent;
}

.channel-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .1);
    border-radius: 4px;
}

.channel-card {
    background: var(--bg3);
    border-radius: 14px;
    padding: 14px 10px;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    transition: background .2s, border-color .2s, transform .15s;
}

.channel-card:hover {
    background: var(--bg4);
    transform: translateY(-1px);
}

.channel-card.active {
    border-color: var(--accent);
    background: rgba(232, 0, 61, .07);
}

.channel-logo {
    width: 60px;
    height: 60px;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.channel-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    background: #fff;
    padding: 4px;
}

.channel-name {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text2);
}

.channel-card.active .channel-name {
    color: #fff;
}


/* ====== MOBILE ====== */
@media (max-width: 900px) {

    html,
    body {
        overflow: hidden;
        height: 100%;
    }

    .main {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        height: calc(100vh - var(--header-h) - var(--ticker-h));
        overflow: hidden;
        gap: 0;
    }

    .player-side {
        display: flex;
        flex-direction: column;
        padding: 10px 10px 0;
        gap: 8px;
        flex-shrink: 0;
    }

    .video-wrapper {
        border-radius: 12px;
        aspect-ratio: 16/9;
        width: 100%;
        flex: none;
        height: auto;
    }

    video {
        height: auto;
    }

    .now-playing {
        border-radius: 10px;
        margin-bottom: 4px;
        flex-shrink: 0;
    }

    /* Channel section fills remaining space */
    .channel-side {
        border-left: none;
        border-top: 1px solid var(--border);
        display: flex;
        flex-direction: column;
        overflow: hidden;
        min-height: 0;
    }

    /* Category tabs fixed */
    .category-tabs {
        flex-shrink: 0;
        padding: 10px 12px 0;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .category-tabs::-webkit-scrollbar {
        display: none;
    }

    /* Search fixed */
    .search-wrap {
        flex-shrink: 0;
        position: relative;
        padding: 8px 12px;
        background: var(--bg2);
    }

    .search-icon {
        left: 24px;
        top: 50%;
        transform: translateY(-50%);
    }

    /* Only grid scrolls */
    .channel-grid {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
        padding: 0 12px 60px;
        height: auto;
    }

    .vol-slider {
        width: 50px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0 12px;
    }

    .viewer-badge {
        padding: 6px 10px;
        font-size: 13px;
    }

    .viewer-label {
        display: none;
    }

    .tg-btn {
        padding: 7px 12px;
        font-size: 12px;
    }

    .player-side {
        padding: 8px 8px 0;
    }

    .channel-card {
        padding: 10px 8px;
    }

    .channel-logo {
        width: 50px;
        height: 50px;
    }

    .channel-name {
        font-size: 11px;
    }

    .channel-grid {
        gap: 8px;
        padding: 0 10px 16px;
    }

    .category-tabs {
        padding: 10px 10px 0;
    }

    .search-wrap {
        padding: 8px 10px;
    }
}

.notice-popup {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    padding: 20px;
}

.notice-box {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 20px;
    padding: 30px 25px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
    animation: popup .4s ease;
}

@keyframes popup {
    from {
        transform: scale(.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Overlay */
.notice-popup {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .75);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    z-index: 99999;
}

/* Box */
.notice-box {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border-radius: 20px;
    padding: 25px 20px;
    text-align: center;
    box-shadow: 0 15px 40px rgba(0, 0, 0, .2);
    animation: popup .3s ease;
}

@keyframes popup {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}


/* Overlay */
.notice-popup {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.notice-popup.active {
    opacity: 1;
    visibility: visible;
}

/* Box */
.notice-box {
    background: #ffffff;
    max-width: 380px;
    width: 90%;
    padding: 30px 26px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.notice-popup.active .notice-box {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.notice-icon {
    font-size: 50px;
    margin-bottom: 10px;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }
}

.notice-box h2 {
    font-size: 24px;
    color: #1a1a1a;
    margin-bottom: 15px;
    font-weight: 700;
}

.notice-box p {
    font-size: 15px;
    color: #666;
    line-height: 1.7;
    margin-bottom: 25px;
}

/* Buttons */
.notice-links {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.notice-links a {
    flex: 1;
    padding: 12px;
    border-radius: 12px;
    text-decoration: none;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.notice-links a:hover {
    transform: translateY(-2px);
    filter: brightness(1.08);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
}

.notice-links a:active {
    transform: translateY(0) scale(0.97);
}

.telegram-btn {
    background: #0088cc;
}

.backup-btn {
    background: #16a34a;
}

#continueBtn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(90deg, #ff5f6d, #ff9966);
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

#continueBtn:hover {
    filter: brightness(1.06);
    box-shadow: 0 8px 20px rgba(255, 95, 109, 0.35);
}

#continueBtn:active {
    transform: scale(0.97);
}

/* Small Android devices */
@media (max-width: 480px) {

    .notice-box {
        max-width: 100%;
        padding: 22px 16px;
    }

    .notice-box h2 {
        font-size: 22px;
    }

    .notice-box p {
        font-size: 14px;
    }

    .notice-links {
        flex-direction: column;
    }

    .notice-links a {
        width: 100%;
    }

    #continueBtn {
        font-size: 15px;
    }
}