/* ============================================================
 *  Sigma Chess — блок трансляции и таблица реестра
 * ============================================================ */

.sigmachess-live-block {
    margin: 0 0 40px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1a1a1a;
}

/* ---------- Слот: адаптивный контейнер под видео ---------- */

.sigmachess-live-slot {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;      /* высота считается автоматически */
    background: #130d31;
    overflow: hidden;
    border-radius: 8px;
}

.sigmachess-live-iframe {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
}

/* ---------- Мета-строка под плеером ---------- */

.sigmachess-live-meta {
    display: flex;
    align-items: baseline;
    gap: 20px;
    margin-top: 20px;
}

.sigmachess-live-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
    color: #1a1a1a;
}

.sigmachess-live-note {
    margin: 12px 0 0 0;
    font-size: 16px;
    line-height: 1.6;
    color: #4b5563;
}

/* ---------- Пустое состояние (если понадобится) ---------- */

.sigmachess-live-block--empty {
    padding: 60px 24px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    text-align: center;
    color: #6b7280;
    font-size: 15px;
}

.sigmachess-live-block--empty p {
    margin: 0;
}

/* ============================================================
 *  Колонка «Тип»: бейджи и кнопка «Смотреть»
 * ============================================================ */

.sigmachess-type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    color: #3538cd;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.sigmachess-type-badge--countdown {
    background: #fff7e6;
    color: #b54708;
    border: 1px solid #fedf89;
}

.sigmachess-type-badge--live {
    color: #2fd335;
    font-weight: 600;
}

.sigmachess-type-badge--finished {
    background: #f2f4f7;
    color: #667085;
    border: 1px solid #e4e7ec;
}

/* Кнопка-ссылка «▶» рядом с таймером */

.sigmachess-live-link {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 10px;
    background: #2fd335;
    color: #fff !important;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.2;
    white-space: nowrap;
}

.sigmachess-live-link:hover {
    background: #b71c1c;
}

/* Кнопка «Смотреть» (модальное окно) */

.sigmachess-watch-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 0;
    border-radius: 8px;
    background: #6346f8;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, transform .1s ease, box-shadow .15s ease;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .08);
    font-family: inherit;
}

.sigmachess-watch-btn:hover {
    background: #1e40af;
    box-shadow: 0 2px 6px rgba(29, 78, 216, .3);
}

.sigmachess-watch-btn:active {
    transform: translateY(1px);
}

.sigmachess-watch-btn:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}

/* ============================================================
 *  Модальное окно с iframe
 * ============================================================ */

body.sigmachess-modal-locked {
    overflow: hidden;
}

.sigmachess-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100000;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

.sigmachess-modal--open {
    display: flex;
}

.sigmachess-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 17, 21, .78);
    backdrop-filter: blur(2px);
    animation: sigmachess-fade .18s ease;
}

.sigmachess-modal__dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1100px;
    background: #0f1115;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
    padding: 16px;
    box-sizing: border-box;
    animation: sigmachess-pop .2s ease;
}

.sigmachess-modal__title {
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    margin: 0 36px 12px 0;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sigmachess-modal__close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    color: #ffffff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease;
}

.sigmachess-modal__close:hover {
    background: rgba(255, 255, 255, .18);
}

.sigmachess-modal__frame-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.sigmachess-modal__frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

@keyframes sigmachess-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes sigmachess-pop {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ============================================================
 *  Адаптив
 * ============================================================ */

/* Планшеты и небольшие экраны */
@media (max-width: 768px) {
    .sigmachess-live-slot {
        /* на планшете оставляем 16:9 — это ещё широкий экран */
        aspect-ratio: 16 / 9;
        border-radius: 6px;
    }

    .sigmachess-live-title {
        font-size: 16px!important;
    }

    .sigmachess-live-note {
        font-size: 15px;
    }

    .sigmachess-live-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .sigmachess-modal {
        padding: 12px;
    }

    .sigmachess-modal__dialog {
        padding: 12px;
        border-radius: 10px;
    }

    .sigmachess-modal__title {
        font-size: 14px;
        margin-bottom: 10px;
    }

    .sigmachess-modal__close {
        top: 4px;
        right: 4px;
        width: 32px;
        height: 32px;
        font-size: 20px;
    }

    .sigmachess-watch-btn {
        width: 100%;
        justify-content: center;
        padding: 10px 12px;
    }

    .sigmachess-type-badge {
        font-size: 12px;
        padding: 4px 8px;
    }
}

/* Смартфоны: вертикальное видео, чтобы занимало экран целиком */
/* Смартфоны: плеер вписывается в экран по высоте,
   ширина при этом остаётся 100% контейнера */
@media (max-width: 560px) {
    .sigmachess-live-slot {
        /* Вертикальное видео, но высота ограничена экраном */
        position: relative;
        width: 100%;
        aspect-ratio: 9 / 16;
        /* Ограничение по высоте: не больше 70% вьюпорта.
           svh — «small viewport height» (учитывает адресную строку
           мобильных браузеров); fallback на vh для старых браузеров. */
        max-height: 30vh;
        max-height: 30svh;
        background: #130d31;
        overflow: hidden;
        border-radius: 6px;
    }

    /* Плеер заполняет слот; если слот «сплющен» max-height,
       iframe тоже сплющится — поэтому пропорция не важна,
       важно только заполнение */
    .sigmachess-live-iframe {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        border: 0;
    }

    /* Модальное окно — та же логика */
    .sigmachess-modal__frame-wrap {
        position: relative;
        width: 100%;
        aspect-ratio: 9 / 16;
        max-height: 80vh;
        max-height: 80svh;
    }

    .sigmachess-modal__frame {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        border: 0;
    }
}

/* Карточная раскладка таблицы на очень узких экранах */
@media (max-width: 560px) {
    .sigmachess-table thead {
        display: none;
    }

    .sigmachess-table,
    .sigmachess-table tbody,
    .sigmachess-table tr,
    .sigmachess-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .sigmachess-table tr {
        margin-bottom: 14px;
        border: 1px solid #e5e7eb;
        border-radius: 10px;
        background: #ffffff;
        overflow: hidden;
        box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
    }

    .sigmachess-table td {
        border: 0;
        border-bottom: 1px solid #f0f0f0;
        padding: 10px 14px;
        text-align: left;
    }

    .sigmachess-table td:last-child {
        border-bottom: 0;
    }

    .sigmachess-table td::before {
        content: attr(data-label);
        display: block;
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: .06em;
        color: #98a2b3;
        margin-bottom: 4px;
    }
}