/* Broadcasts panel (templates/_watch_panel.html, watch.py): full panel on /esport/scrims,
   one-line bar on /esport/matcherino. Colours come from the site theme; YouTube red stays fixed. */
.bc {
    --yt: #ff0033;
    --bc-line: rgba(var(--primary-rgb), 0.22);
    background: var(--card);
    border: 2px solid var(--bc-line);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    margin-bottom: 0.75rem;
    color: var(--text);
}
.bc--live {
    border-color: rgba(var(--primary-rgb), 0.6);
    box-shadow: 0 0 0 1px rgba(var(--primary-rgb), 0.15), 0 6px 28px rgba(var(--primary-rgb), 0.2);
}
.bc button { font: inherit; }
.bc a:focus-visible, .bc button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ── Bar ── */
.bc-bar {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.8rem;
    background: var(--dark);
    border-bottom: 2px solid rgba(var(--primary-rgb), 0.4);
    min-width: 0;
}
.bc-title {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}
.bc-tag { font-size: 0.72rem; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-tally {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex: none;
    padding: 0.3rem 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: var(--text-dim);
    font: 800 0.66rem/1 ui-monospace, SFMono-Regular, Consolas, monospace;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
.bc-tally i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.bc--live .bc-tally { background: var(--yt); border-color: var(--yt); color: #fff; }
.bc--live .bc-tally i { background: #fff; animation: bc-pulse 1.4s ease-in-out infinite; }
.bc--upcoming .bc-tally { border-color: #f59e0b; color: #fbbf24; }
@keyframes bc-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.3; transform: scale(0.6); } }

.bc-chips { display: flex; gap: 0.35rem; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.bc-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.65rem 0.2rem 0.2rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: transparent;
    color: var(--text-dim);
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}
.bc-chip:hover { color: var(--text); }
.bc-chip.is-on { color: var(--text); border-color: rgba(var(--primary-rgb), 0.6); background: rgba(var(--primary-rgb), 0.12); }
.bc-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--yt); animation: bc-pulse 1.4s ease-in-out infinite; }

.bc-av {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(var(--primary-rgb), 0.35);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
}
.bc-av--lg { width: 38px; height: 38px; font-size: 1rem; }

/* YouTube-style buttons: white pill with the red play mark, red while live */
.bc-subscribe, .bc-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex: none;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: #f1f1f1;
    color: #0f0f0f;
    font-size: 0.78rem;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, transform 0.15s;
}
.bc-subscribe:hover, .bc-cta:hover { background: #fff; transform: translateY(-1px); }
.bc-yt { width: 20px; height: 14px; flex: none; }
.bc-yt rect { fill: var(--yt); }
.bc-yt path { fill: #fff; }
.bc--live .bc-cta { background: var(--yt); color: #fff; }
.bc--live .bc-cta .bc-yt rect { fill: #fff; }
.bc--live .bc-cta .bc-yt path { fill: var(--yt); }
.bc-cta { margin-left: auto; }
.bc-now { min-width: 0; flex: 1; font-size: 0.8rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc--compact .bc-bar { border-bottom: 0; }

/* ── Stage + rail ── */
.bc-ch { display: grid; grid-template-columns: minmax(0, 720px) minmax(260px, 1fr); }
.bc-ch[hidden] { display: none; }
.bc-stage { position: relative; aspect-ratio: 16 / 9; background: #000; }
.bc-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.bc-facade {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: #000;
    color: #fff;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
}
/* hqdefault is 4:3 with black bars; cover on a 16:9 box crops exactly the bars */
.bc-facade img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.bc-facade::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, transparent 26%, transparent 48%, rgba(0, 0, 0, 0.88) 100%);
}
.bc-facade:hover img { transform: scale(1.035); }
/* viewfinder corners */
.bc-vf {
    position: absolute;
    inset: 14px;
    z-index: 1;
    opacity: 0.55;
    pointer-events: none;
    --c: rgba(255, 255, 255, 0.9);
    background:
        linear-gradient(var(--c), var(--c)) top left / 22px 2px,
        linear-gradient(var(--c), var(--c)) top left / 2px 22px,
        linear-gradient(var(--c), var(--c)) top right / 22px 2px,
        linear-gradient(var(--c), var(--c)) top right / 2px 22px,
        linear-gradient(var(--c), var(--c)) bottom left / 22px 2px,
        linear-gradient(var(--c), var(--c)) bottom left / 2px 22px,
        linear-gradient(var(--c), var(--c)) bottom right / 22px 2px,
        linear-gradient(var(--c), var(--c)) bottom right / 2px 22px;
    background-repeat: no-repeat;
    transition: inset 0.3s ease, opacity 0.3s;
}
.bc-facade:hover .bc-vf { inset: 10px; opacity: 0.85; }
.bc-flag {
    position: absolute;
    top: 26px;
    left: 28px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.5rem;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.65);
    font: 800 0.68rem/1 ui-monospace, SFMono-Regular, Consolas, monospace;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
.bc-flag i { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: bc-pulse 1.4s ease-in-out infinite; }
.bc-ch--live .bc-flag { background: var(--yt); }
.bc-ch--upcoming .bc-flag { background: #b45309; }
.bc-play {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    width: 76px;
    height: 54px;
    transform: translate(-50%, -50%);
    transition: transform 0.2s ease;
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.55));
}
.bc-play svg { display: block; width: 100%; height: 100%; }
.bc-play rect { fill: var(--yt); }
.bc-play path { fill: #fff; }
.bc-facade:hover .bc-play { transform: translate(-50%, -50%) scale(1.1); }
.bc-cap {
    position: absolute;
    right: 28px;
    bottom: 24px;
    left: 28px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.bc-cap b {
    display: -webkit-box;
    overflow: hidden;
    font-size: clamp(0.95rem, 1.5vw, 1.3rem);
    font-weight: 800;
    line-height: 1.2;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.bc-cap small { color: rgba(255, 255, 255, 0.75); font-size: 0.75rem; font-weight: 600; }

/* contain: size keeps the rail from growing the row: it is as tall as the player and scrolls */
.bc-rail {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-left: 1px solid var(--bc-line);
    background: rgba(0, 0, 0, 0.18);
    contain: size;
    overflow-y: auto;
    scrollbar-width: thin;
}
.bc-who-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.75rem 0.8rem; border-bottom: 1px solid var(--bc-line); }
.bc-who { display: flex; align-items: center; gap: 0.6rem; flex: 1; min-width: 0; color: var(--text); text-decoration: none; }
.bc-who span { min-width: 0; }
.bc-who b { display: block; overflow: hidden; font-size: 0.92rem; white-space: nowrap; text-overflow: ellipsis; }
.bc-who small { display: block; color: var(--text-dim); font-size: 0.66rem; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; }
.bc-who:hover b { text-decoration: underline; }
.bc-ch--live .bc-who .bc-av { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--yt); }
.bc-rail-h { padding: 0.65rem 0.8rem 0.35rem; color: var(--text-dim); font-size: 0.66rem; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; }
.bc-list { margin: 0; padding: 0 0.4rem 0.5rem; list-style: none; }
.bc-item {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 0.65rem;
    align-items: start;
    width: 100%;
    padding: 0.4rem;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}
.bc-item:hover { background: rgba(255, 255, 255, 0.05); }
.bc-item.is-on { background: rgba(var(--primary-rgb), 0.14); box-shadow: inset 3px 0 0 var(--primary); }
.bc-thumb { position: relative; display: block; overflow: hidden; border-radius: 6px; background: #000; aspect-ratio: 16 / 9; }
.bc-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.bc-meta { min-width: 0; }
.bc-meta b {
    display: -webkit-box;
    overflow: hidden;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.25;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.bc-meta time { display: block; margin-top: 0.2rem; color: var(--text-dim); font-size: 0.68rem; }
/* "now playing" bars on the list item that is in the player */
.bc-eq { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; gap: 3px; background: rgba(0, 0, 0, 0.55); }
.bc-eq i { width: 3px; height: 12px; border-radius: 1px; background: #fff; animation: bc-eq 0.9s ease-in-out infinite; }
.bc-eq i:nth-child(2) { animation-delay: -0.3s; }
.bc-eq i:nth-child(3) { animation-delay: -0.6s; }
.bc-ch.is-playing .bc-item.is-on .bc-eq { display: flex; }
@keyframes bc-eq { 0%, 100% { transform: scaleY(0.3); } 50% { transform: scaleY(1); } }
.bc-blurb { margin: 0; padding: 0.8rem; color: var(--text-dim); font-size: 0.8rem; line-height: 1.45; }
/* live chat takes the rail once a live stream is playing */
.bc-chat { flex: 1; min-height: 0; background: #0f0f0f; }
.bc-chat iframe { display: block; width: 100%; height: 100%; border: 0; }
.bc-rail.has-chat { overflow: hidden; }
.bc-rail.has-chat .bc-rail-h, .bc-rail.has-chat .bc-list, .bc-rail.has-chat .bc-blurb { display: none; }

/* ── Off air: a muted test card ── */
.bc-off { grid-column: 1 / -1; display: flex; align-items: center; gap: 1rem; padding: 0.9rem; }
.bc-testcard { position: relative; flex: none; width: 200px; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 8px; }
.bc-testcard::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.25) 0 1px, transparent 1px 3px),
        linear-gradient(90deg, #0000bf 0 14.28%, #131313 0 28.57%, #bf00bf 0 42.86%, #131313 0 57.14%, #00bfbf 0 71.43%, #131313 0 85.71%, #bfbfbf 0) left bottom / 100% 24% no-repeat,
        linear-gradient(90deg, #bfbfbf 0 14.28%, #bfbf00 0 28.57%, #00bfbf 0 42.86%, #00bf00 0 57.14%, #bf00bf 0 71.43%, #bf0000 0 85.71%, #0000bf 0);
    filter: saturate(0.6) brightness(0.62);
}
.bc-testcard span {
    position: absolute;
    top: 50%;
    left: 50%;
    padding: 0.4rem 0.7rem;
    border: 1px solid rgba(255, 255, 255, 0.55);
    background: #0b0b0b;
    color: #fff;
    font: 800 0.78rem/1 ui-monospace, SFMono-Regular, Consolas, monospace;
    letter-spacing: 3px;
    text-transform: uppercase;
    white-space: nowrap;
    transform: translate(-50%, -50%);
    animation: bc-flicker 5s steps(1) infinite;
}
@keyframes bc-flicker { 0%, 92%, 96%, 100% { opacity: 1; } 94%, 98% { opacity: 0.55; } }
.bc-off-text { display: flex; flex: 1; flex-direction: column; gap: 0.45rem; min-width: 0; }
.bc-off-text p { margin: 0; color: var(--text-dim); font-size: 0.82rem; line-height: 1.45; }

/* ── Phones and narrow columns ── */
@media (max-width: 900px) {
    .bc-ch { grid-template-columns: 1fr; }
    .bc-rail { contain: none; overflow: visible; border-top: 1px solid var(--bc-line); border-left: 0; }
    .bc-list { display: flex; gap: 0.5rem; padding: 0 0.6rem 0.7rem; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: thin; }
    .bc-list li { flex: 0 0 160px; scroll-snap-align: start; }
    .bc-item { grid-template-columns: 1fr; gap: 0.35rem; }
    .bc-chat { flex: none; height: 380px; }
}
@media (max-width: 600px) {
    .bc-tag { display: none; }
    .bc-bar { flex-wrap: wrap; gap: 0.5rem; padding: 0.5rem 0.6rem; }
    .bc-chips { flex-basis: 100%; margin-left: 0; }
    .bc-vf { inset: 8px; }
    .bc-flag { top: 16px; left: 16px; }
    .bc-cap { right: 16px; bottom: 14px; left: 16px; }
    .bc-play { width: 56px; height: 40px; }
    .bc-off { flex-wrap: wrap; gap: 0.75rem; }
    .bc-testcard { width: 112px; }
    .bc-off-text { flex-basis: calc(100% - 130px); }
    .bc-off .bc-subscribe { width: 100%; justify-content: center; }
    .bc--compact .bc-now { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .bc *, .bc *::before, .bc *::after { animation: none !important; transition: none !important; }
}
