/* --- Раздел «Трансляции» ---
   Совместимость с Tizen: без display:grid, без gap, без inset и без
   aspect-ratio — на старых телевизорах их нет, и раскладка рассыпается.
   Отступы задаются margin, как в .vod-grid. */

.sports-panel {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    /* Оверлей сдвинут на ширину рейла — поджимаем правый край, как .search-panel */
    right: 8rem;
    z-index: 12;
    box-sizing: border-box;
    pointer-events: auto;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
    background-color: #0F0F0F;
    overflow: hidden;
}

.sports-panel.hidden {
    display: none;
}

/* Задник стадиона: 70% ширины, прижат вправо вверх — как в Android */
.sports-panel::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 70%;
    background-image: url('images/sports_bg.jpg');
    background-size: 100% auto;
    background-position: top right;
    background-repeat: no-repeat;
    opacity: 0.8;
}

/* Растушёвка задника: слева уводим в фон, снизу гасим втрое,
   как три наложенных вертикальных градиента в Android */
.sports-panel::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-image:
        linear-gradient(to bottom, rgba(15, 15, 15, 0) 55%, #0F0F0F 72%),
        linear-gradient(to bottom, rgba(15, 15, 15, 0) 55%, #0F0F0F 72%),
        linear-gradient(to bottom, rgba(15, 15, 15, 0) 55%, #0F0F0F 72%),
        linear-gradient(to right, #0F0F0F 30%, rgba(15, 15, 15, 0.5) 38%, rgba(15, 15, 15, 0) 45%);
}

.sports-shell {
    position: relative;
    z-index: 1;
    display: -webkit-flex;
    display: flex;
    -webkit-flex: 1;
    flex: 1;
    min-height: 0;
}

.sports-shell.hidden {
    display: none;
}

/* Список турниров.
   Ширина как в андроиде — там LazyColumn с width(220.dp). У нас стояло 26rem,
   то есть 260dp: на прежнем мелком масштабе это было 390 пикселей и разница не
   бросалась в глаза, а после выравнивания масштаба стало 520 против положенных
   440. Восемьдесят лишних пикселей панель забирала у матчей: правая часть
   живёт на flex: 1 и получает ровно остаток. */
.sports-competitions {
    width: 22rem;
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
    overflow-y: auto;
    padding: 2.4rem 1.2rem;
    background: rgba(0, 0, 0, 0.3);
    scrollbar-width: none;
    -webkit-transition: width 0.3s ease, padding 0.3s ease;
    transition: width 0.3s ease, padding 0.3s ease;
}

/* Ушли к карточкам — список турниров убирается, освобождая место матчам.
   Так это сделано в андроиде: AnimatedVisibility со свёртыванием к левому
   краю за те же 300 мс, и hideSidebar() при переходе на карточку. */
.sports-competitions.collapsed {
    width: 0;
    padding-left: 0;
    padding-right: 0;
    overflow: hidden;
}

/* У свёрнутой панели ширина ноль, и бегущая строка крутилась бы впустую на
   невидимом элементе — телевизору это даром не даётся. */
.sports-competitions.collapsed .sports-comp-name {
    -webkit-animation: none;
    animation: none;
}

.sports-competitions::-webkit-scrollbar {
    display: none;
}

.sports-comp-item {
    height: 4.8rem;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    padding: 0 1.2rem;
    margin-bottom: 0.8rem;
    border-radius: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Бегущая строка для названий, которые не влезают.
   Расстояние и длительность приходят из sports.js: они зависят от длины
   конкретного названия. Стоянки на краях делаем через ступени в keyframes —
   так строку успевают прочитать и в начале, и в конце.
   Двигаем transform, а не left: на телевизорах это единственный дешёвый путь. */
.sports-comp-item.marquee,
.sports-info-title.marquee {
    text-overflow: clip;
}

/* Обёртки блочные всегда, а не только при прокрутке: у строчного элемента
   scrollWidth равен ширине родителя, и переполнение не разглядеть — заголовок
   матча так и не поехал, пока это не исправили. */
.sports-comp-name,
.sports-info-title-text {
    display: inline-block;
}

.sports-comp-item.marquee .sports-comp-name,
.sports-info-title.marquee .sports-info-title-text {
    -webkit-animation-name: sports-marquee;
    animation-name: sports-marquee;
    -webkit-animation-timing-function: linear;
    animation-timing-function: linear;
    -webkit-animation-iteration-count: infinite;
    animation-iteration-count: infinite;
}

@-webkit-keyframes sports-marquee {
    0%, 20% { -webkit-transform: translateX(0); }
    50%, 70% { -webkit-transform: translateX(var(--marquee-shift, 0)); }
    100% { -webkit-transform: translateX(0); }
}

@keyframes sports-marquee {
    0%, 20% { transform: translateX(0); }
    50%, 70% { transform: translateX(var(--marquee-shift, 0)); }
    100% { transform: translateX(0); }
}

.sports-comp-item.selected {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    font-weight: 700;
}

.sports-comp-item.focused {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    box-shadow: inset 0 0 0 0.2rem var(--premium-accent);
}

/* Правая часть */
.sports-content {
    position: relative;
    z-index: 1;
    -webkit-flex: 1;
    flex: 1;
    min-width: 0;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
    padding: 3.2rem 4.8rem 2.4rem;
}

.sports-info {
    -webkit-flex: 0 0 auto;
    flex: 0 0 auto;
    max-width: 55%;
    min-height: 22rem;
}

.sports-info-title {
    font-size: 2.8rem;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sports-info-meta {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    margin-top: 0.8rem;
}

.sports-info-meta>* {
    margin-right: 0.8rem;
}

.sports-badge {
    padding: 0.2rem 0.6rem;
    border-radius: 0.4rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    white-space: nowrap;
}

.sports-badge-live {
    background: #228B22;
}

.sports-badge-warn {
    background: #E6A23C;
}

.sports-meta-time {
    font-size: 1.4rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
}

.sports-meta-round {
    font-size: 1.4rem;
    color: rgba(255, 255, 255, 0.45);
}

.sports-info-score {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    margin-top: 2.4rem;
}

.sports-info-score>* {
    margin-right: 2.4rem;
}

.sports-score-text {
    font-size: 4.8rem;
    font-weight: 800;
    color: #fff;
    line-height: 1;
    white-space: nowrap;
}

.sports-logo {
    object-fit: contain;
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
}

.sports-logo-sm {
    width: 4rem;
    height: 4rem;
}

.sports-logo-md {
    width: 6.4rem;
    height: 6.4rem;
}

.sports-logo-lg {
    width: 8rem;
    height: 8rem;
}

.sports-logo-empty {
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.sports-where,
.sports-details-where {
    margin-top: 2.4rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
}

.sports-channel-row {
    display: -webkit-flex;
    display: flex;
    margin-top: 0.8rem;
}

.sports-channel-row>* {
    margin-right: 0.6rem;
}

.sports-channel-chip {
    width: 3.6rem;
    height: 3.6rem;
    border-radius: 0.4rem;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.1);
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
}

.sports-channel-chip-text {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
}

/* Заголовок сетки */
.sports-grid-head {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    margin-top: 2.4rem;
    padding-bottom: 0.4rem;
}

#sportsGridTitle {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
}

#sportsGridCounter {
    font-size: 1.6rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Сетка матчей: перенос по flex-wrap и margin — как .vod-grid.
   Сколько войдёт в ряд, зависит от того, свёрнут ли список турниров. */
.sports-grid {
    -webkit-flex: 1;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: row;
    flex-direction: row;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-align-content: flex-start;
    align-content: flex-start;
    padding: 0.6rem 0.4rem 1.2rem;
    scrollbar-width: none;
}

.sports-grid::-webkit-scrollbar {
    display: none;
}

.sports-grid>* {
    margin: 0 0.8rem 1.6rem 0;
}

.sports-card {
    /* Ширина ровно по андроидной формуле:

           posterWidth = (screenWidth - 48*2 - 6*8) / 7

       то есть от всего экрана, а не от области матчей — 233 пикселя при 1920.
       Раньше делилась ширина области и делилась на семь, отчего выходило по
       168 пикселей: карточки были вдвое у́же андроидных.

       Считать от экрана важно и потому, что список турниров сворачивается,
       когда зритель уходит к матчам. При долевой ширине карточки от этого
       раздувались бы почти вдвое; теперь они остаются прежними, а в ряд просто
       помещается больше — как в андроиде. Сколько именно, вёрстка решает сама
       переносом, а навигация считает это по факту (см. colsInRow). */
    width: calc((100vw - 9.6rem - 4.8rem) / 7);
    height: 17.5rem;
    border-radius: 0.8rem;
    background-color: #1A1A1A;
    /* Затемнение поверх стадиона — Android держит картинку на alpha 0.4 */
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.58), rgba(0, 0, 0, 0.58)),
        url('images/sports_card.jpg');
    background-size: cover;
    background-position: center;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: space-around;
    justify-content: space-around;
    padding: 0.8rem;
    box-sizing: border-box;
    overflow: hidden;
    -webkit-transition: -webkit-transform 0.15s ease;
    transition: transform 0.15s ease;
}

.sports-card.focused {
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)),
        url('images/sports_card.jpg');
    /* Рамка внутрь, а не наружу — как border(3.dp) в андроиде: там он рисуется
       в границах карточки. Наружу она давала 6 пикселей сверх увеличения, вместе
       выходило вдвое больше бокового поля сетки (8 пикселей), и у крайних
       карточек рамку срезало по overflow. Теперь за край выступает только само
       увеличение — около шести пикселей, и оно в поле помещается. */
    box-shadow: inset 0 0 0 0.3rem var(--premium-accent);
    -webkit-transform: scale(1.05);
    transform: scale(1.05);
    z-index: 10;
}

.sports-card-top {
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
    color: rgba(255, 255, 255, 0.75);
    white-space: nowrap;
}

.sports-card-live {
    color: #3FBF3F;
}

.sports-card-warn {
    color: #E6A23C;
}

.sports-card-score {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
}

.sports-empty {
    width: 100%;
    padding: 4rem 0;
    text-align: center;
    font-size: 1.8rem;
    color: rgba(255, 255, 255, 0.5);
}

/* Экран матча */
.sports-details {
    position: relative;
    z-index: 1;
    -webkit-flex: 1;
    flex: 1;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    padding: 4rem 6.4rem;
}

.sports-details.hidden {
    display: none;
}

/* На экране матча статус — просто цветной текст с разрядкой, без плашки */
.sports-details-status {
    -webkit-align-self: center;
    align-self: center;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.2rem;
    color: #D3D3D3;
}

.sports-status-live {
    color: #3FBF3F;
}

.sports-status-warn {
    color: #E6A23C;
}

.sports-status-muted {
    color: #D3D3D3;
}

.sports-details-teams {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: center;
    justify-content: center;
    margin-top: 2.4rem;
}

.sports-details-team {
    -webkit-flex: 1;
    flex: 1;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-align-items: center;
    align-items: center;
}

.sports-details-name {
    margin-top: 1.6rem;
    font-size: 2.4rem;
    font-weight: 700;
    color: #fff;
    text-align: center;
}

.sports-details-center {
    width: 18rem;
    text-align: center;
}

.sports-details-score {
    font-size: 4.8rem;
    font-weight: 900;
    color: #fff;
}

.sports-details-time {
    margin-top: 1.2rem;
    font-size: 1.8rem;
    color: rgba(255, 255, 255, 0.6);
}

.sports-ch-row {
    display: -webkit-flex;
    display: flex;
    margin-top: 0.8rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.6rem 0.4rem;
    scrollbar-width: none;
}

.sports-ch-row::-webkit-scrollbar {
    display: none;
}

.sports-ch-row>* {
    margin-right: 1.2rem;
}

.sports-ch-row>*:last-child {
    margin-right: 0;
}

.sports-ch-card {
    /* Размеры из Android: 128dp x 135dp при 1rem = 10px */
    width: 12.8rem;
    height: 13.5rem;
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
    border-radius: 1.4rem;
    border: 0.2rem solid transparent;
    background: transparent;
    padding: 0.6rem;
    box-sizing: border-box;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-align-items: center;
    align-items: center;
    overflow: hidden;
}

/* В Android рамка фокуса здесь светло-серая, а не акцентная */
.sports-ch-card.focused {
    border-color: #BBBBBB;
}

/* Логотипы каналов приходят с разным фоном — белая плашка приводит их
   к одному виду, как Surface(color = White) в Android */
.sports-ch-logo-box {
    position: relative;
    width: 6.8rem;
    height: 6.8rem;
    border-radius: 1.2rem;
    background: #FFFFFF;
    overflow: hidden;
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
}

.sports-ch-logo {
    position: absolute;
    top: 0.4rem;
    left: 0.4rem;
    width: calc(100% - 0.8rem);
    height: calc(100% - 0.8rem);
    object-fit: contain;
}

.sports-ch-name {
    margin-top: 0.8rem;
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.sports-ch-action {
    margin-top: 0.2rem;
    font-size: 1.1rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Выбор режима просмотра завершённого матча */
.sports-dialog {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    z-index: 5;
}

.sports-dialog.hidden {
    display: none;
}

.sports-dialog-box {
    min-width: 36rem;
    padding: 2.4rem;
    border-radius: 2rem;
    background: rgba(21, 21, 21, 0.97);
    border: 0.1rem solid rgba(255, 255, 255, 0.08);
    text-align: center;
}

.sports-dialog-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: #fff;
}

.sports-dialog-options {
    display: -webkit-flex;
    display: flex;
    margin-top: 2rem;
}

.sports-dialog-options>* {
    margin-right: 1.2rem;
}

.sports-dialog-options>*:last-child {
    margin-right: 0;
}

.sports-dialog-option {
    -webkit-flex: 1;
    flex: 1;
    padding: 1.2rem 1.6rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.08);
    font-size: 1.5rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
}

.sports-dialog-option.focused {
    box-shadow: 0 0 0 0.2rem var(--premium-accent);
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}
