/* ── Reset ───────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --red:    #cc0022;
    --red-dk: #880011;
    --bg:     #080808;
    --text:   #e8e8e8;
    --muted:  #888;
    --row-h: 30px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --ticker-stack-offset: calc(var(--safe-bottom) + 8px);
    --bottom-bar-gap: 20px;
}

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

/* ── Channel wrap — full viewport height ─────────────── */
#channel-wrap {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: #000;
    overflow: hidden;
}

/* ── Video ──────────────────────────────────────────── */
#player-stage,
#player,
.yt-player-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

#player,
.yt-player-layer {
    object-fit: cover;
}

.yt-player-layer {
    border: 0;
    z-index: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    overflow: hidden;
}

.yt-player-layer iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Cover trick — fills any aspect ratio screen without black bars */
    width: 177.78vh;   /* 100vh × 16/9 */
    height: 100vh;
    min-width: 100%;
    min-height: 56.25vw; /* 100vw × 9/16 */
    border: 0;
}

/* ── Logo overlay ────────────────────────────────────── */
#channel-logo {
    position: absolute;
    top: 16px;
    left: 20px;
    height: 56px;
    width: auto;
    z-index: 10;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.7));
}

/* ── Bottom gradient ─────────────────────────────────── */
#bottom-fade {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 220px;
    background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, transparent 100%);
    pointer-events: none;
    z-index: 5;
}

#overlay-tickers {
    position: absolute;
    left: 0;
    right: 0;
    bottom: var(--ticker-stack-offset);
    z-index: 6;
}

/* ── Bottom bar ──────────────────────────────────────── */
#bottom-bar {
    position: absolute;
    bottom: calc(var(--safe-bottom) + var(--bottom-bar-gap));
    left: 0; right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 10;
    transition: bottom 0.3s ease;
}

/* Live info — center bottom */
#live-info {
    display: flex;
    align-items: center;
    background: rgba(0,0,0,0.55);
    padding: 7px 18px;
    border-radius: 22px;
    border: 1px solid rgba(255,255,255,0.12);
    backdrop-filter: blur(8px);
    max-width: 72%;
    overflow: hidden;
}

#now-playing-title {
    font-size: 13px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Bottom right: clock + unmute */
#bottom-right {
    display: flex;
    align-items: center;
}

#unmute-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(255,255,255,0.13);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.22);
    padding: 8px 18px;
    border-radius: 22px;
    font-size: 13px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: background 0.2s;
}

#unmute-btn:hover { background: rgba(255,255,255,0.24); }
#unmute-icon { font-size: 12px; }

/* ── Ticker Section ──────────────────────────────────── */
#ticker-section {
    width: 100%;
    background: #080808;
    margin-top: 0;
}

.ticker-row {
    display: flex;
    align-items: stretch;
    height: var(--row-h);
    overflow: hidden;
}

.ticker-row-overlay {
    border-top: 1px solid rgba(255,255,255,0.06);
}

.ticker-row-below {
    border-top: 1px solid #161616;
}

.ticker-ch-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.ticker-ch-track {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    animation: ticker-scroll linear infinite;
    will-change: transform;
}

@keyframes ticker-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Headline text — equal padding dono taraf */
.t-item {
    display: inline-block;
    padding: 0 20px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

/* Dot separator — item padding hi equal space deta hai dono taraf */
.t-sep {
    display: inline-block;
    font-size: 9px;
    line-height: 1;
    flex-shrink: 0;
    vertical-align: middle;
}

/* ── 7 Row color schemes — red/dark/white, NO black ──── */

/* Row 1 — Almost black bg, white text, red dot */
/* Row 1 — Almost black bg, white text, red dot */
.ta { background: #0f0003; }
.ta .t-item { color: #ffffff; }
.ta .t-sep  { color: #cc0022; }

/* Row 2 — Light yellow bg, dark red text */
.tb { background: #fff3a0; }
.tb .t-item { color: #7a0010; font-weight: 800; font-size: 14px; }
.tb .t-sep  { color: #cc0022; }

/* Row 3 — Dark maroon bg, light pink text, pink dot */
.tc { background: #1a0006; }
.tc .t-item { color: #ffd0d8; }
.tc .t-sep  { color: #ff4466; }

/* Row 4 — Dark yellow/amber bg, dark red text */
.td { background: #cc8800; }
.td .t-item { color: #3a0005; font-weight: 800; font-size: 14px; }
.td .t-sep  { color: #7a0010; }

/* Row 5 — Very dark bg, light red text, red dot */
.te { background: #0a0002; }
.te .t-item { color: #ff8899; font-size: 14px; }
.te .t-sep  { color: #cc0022; }

/* Row 6 — Dark rose bg, white text, white dot */
.tf { background: #5c000f; }
.tf .t-item { color: #fff0f2; }
.tf .t-sep  { color: #ffcccc; }

/* Row 7 — White bg, dark red text, red dot */
.tg { background: #fff5f6; }
.tg .t-item { color: #8b0015; font-weight: 500; }
.tg .t-sep  { color: #cc0022; }

/* ── Ads Section ─────────────────────────────────────── */
#ads-section {
    background: #000;
    padding: 0;
}

#ads-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: auto;
    grid-auto-flow: dense;
    gap: 0;
}

.ad-item {
    display: block;
    position: relative;
    min-width: 0;
    border-radius: 0;
    overflow: hidden;
    border: none;
    cursor: pointer;
    background: #000;
    aspect-ratio: 1 / 1;
    grid-column: span 3;
}

.ad-item[data-span="9"] { grid-column: span 1; }

.ad-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@media (max-width: 1280px) {
    #channel-wrap {
        height: auto;
        aspect-ratio: 16 / 9;
    }

    .yt-player-layer iframe {
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        transform: none;
        min-width: unset;
        min-height: unset;
    }

    /* Logo */
    #channel-logo { height: 46px; top: 10px; left: 12px; }

    /* Ticker row height + font */
    :root { --row-h: 26px; }
    .t-item { font-size: 13px; padding: 0 16px; }

    /* Bottom bar */
    #bottom-bar { padding: 0 12px; }
    #live-info { padding: 5px 12px; border-radius: 16px; max-width: 60%; }
    #now-playing-title { font-size: 11px; }
    #unmute-btn { padding: 5px 12px; font-size: 11px; gap: 5px; border-radius: 16px; }
    #unmute-icon { font-size: 11px; }
}

@media (max-width: 480px) {
    /* Video full screen on mobile */
    #channel-wrap {
        height: 100vh;
        height: 100dvh;
        aspect-ratio: unset;
    }

    .yt-player-layer iframe {
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 177.78vh;
        height: 100vh;
        min-width: 100%;
        min-height: 56.25vw;
    }

    /* Logo */
    #channel-logo { height: 48px; top: 8px; left: 8px; }

    /* Ticker */
    :root { --row-h: 22px; }
    .t-item { font-size: 12px; padding: 0 12px; }

    /* Bottom bar */
    #bottom-bar { padding: 0 8px; }
    #live-info { padding: 4px 10px; max-width: 55%; }
    #now-playing-title { font-size: 10px; }
    #unmute-btn { padding: 4px 10px; font-size: 10px; gap: 4px; }
}

/* ── Shared section header ───────────────────────────── */
.section-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, #2a2a2a, transparent);
}
.section-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--muted);
    white-space: nowrap;
}

/* ── Affiliate Section ───────────────────────────────── */
#aff-section {
    background: #0a0a0a;
    padding: 40px 40px 52px;
    border-top: 1px solid #181818;
}

#aff-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 32px;
}

#aff-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.aff-item {
    background: #111;
    border: 1px solid #1e1e1e;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
    display: flex;
    flex-direction: column;
    flex: 0 0 280px;
    width: 280px;
}

.aff-item:hover {
    transform: translateY(-5px);
    border-color: #333;
    box-shadow: 0 14px 36px rgba(0,0,0,0.7);
}

.aff-img-wrap {
    width: 100%;
    background: #0d0d0d;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.aff-img-wrap img {
    width: 100%;
    height: auto;
    max-height: 280px;
    object-fit: contain;
    display: block;
}

.aff-body {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aff-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.aff-desc {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.6;
    flex: 1;
}

.aff-btn {
    margin-top: 8px;
    background: var(--red);
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
    align-self: flex-start;
}

.aff-btn:hover { background: var(--red-dk); }
