#games {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
}


/* Match card */

.live-game {
    position: relative;
    min-width: 0;

    background: white;

    border: 1px solid #e5e5e5;
    border-left: 4px solid #6D071A;
    border-radius: 10px;

    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.live-game:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(109, 7, 26, 0.10);
}


/* Live badge */

.live-indicator {
    display: flex;
    align-items: center;
    gap: 5px;

    padding: 4px 9px;

    background-color: #f9eef1;
    color: #6D071A;

    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
}

.live-indicator span {
    width: 7px;
    height: 7px;

    border-radius: 50%;
    background-color: #d40027;

    animation: livePulse 1.5s infinite;
}

@keyframes livePulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.4;
        transform: scale(1.25);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}


/* Table wrapper */

.live-table-wrapper {
    width: 100%;
    overflow-x: auto;
}


/* Table */

.live-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.live-table tr:first-child {
    border-bottom: 1px solid #eeeeee;
}

.live-table td {
    padding: 6px 5px;
    vertical-align: middle;
}


/* Player information */

.player-country {
    width: 34px;
    text-align: center;
}

.player-country img {
    width: 24px;
    height: auto;
}

.player-info {
    width: auto;
    padding: 5px 7px;
}

.player-line {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    min-height: 30px;
}

.player-line.partner {
    margin-top: 3px;
    padding-top: 3px;
    border-top: 1px dashed #ececec;
}

.player-flag {
    width: 21px;
    height: 14px;

    object-fit: cover;
    flex-shrink: 0;

    border-radius: 2px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.player-line span {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;

    font-size: 12px;
    font-weight: 600;
}


/* Avatar */

.player-avatar {
    width: 36px;
}

.player-avatar-img {
    width: 28px;
    height: 28px;

    flex-shrink: 0;
    border-radius: 50%;
}


/* Player */

.player-name {
    min-width: 100px;

    color: #27272a;

    font-size: 12px;
    font-weight: 600;

    white-space: nowrap;
}


/* Sets won */

.sets-won {
    width: 34px;

    text-align: center;

    color: #6D071A;

    font-size: 18px;
    font-weight: 700;

    border-left: 1px solid #eeeeee;
    border-right: 1px solid #eeeeee;
}


/* Individual set scores */

.set-score {
    width: 31px;
    padding: 6px 3px;

    text-align: center;

    color: #52525b;

    font-size: 12px;
    font-weight: 600;
}


/* Empty state */

.live-empty {
    grid-column: 1 / -1;

    padding: 30px 18px;

    text-align: center;
    color: #71717a;

    background: white;

    border: 1px solid #e4e4e7;
    border-radius: 10px;
}


/* Medium screens: one match per row if two cards become too narrow */

@media screen and (max-width: 900px) {
    #games {
        grid-template-columns: 1fr;
    }
}


/* Mobile */

@media screen and (max-width: 600px) {

    #games {
        grid-template-columns: 1fr;
        gap: 6px;
        margin-top: 10px;
    }

    .live-game {
        border-left-width: 3px;
        border-radius: 7px;
        box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
    }

    .live-game:hover {
        transform: none;
    }

    .live-indicator {
        padding: 2px 7px;
        font-size: 9px;
    }

    .live-indicator span {
        width: 6px;
        height: 6px;
    }

    .live-table-wrapper {
        overflow-x: hidden;
    }

    .live-table td {
        padding: 3px 4px;
    }

    .player-info {
        width: auto;
        padding: 3px 5px;
    }

    .player-line {
        gap: 5px;
        min-height: 23px;
    }

    .player-line.partner {
        margin-top: 1px;
        padding-top: 1px;
    }

    .player-avatar-img {
        display: block;

        width: 26px;
        height: 26px;

        flex-shrink: 0;
    }

    .player-line {
        gap: 5px;
        min-height: 28px;
    }

    .player-flag {
        width: 20px;
        height: 13px;
    }

    .player-line span {
        font-size: 12px;
    }

    .sets-won {
        width: 29px;
        min-width: 29px;

        padding-left: 3px !important;
        padding-right: 3px !important;

        font-size: 17px;
    }

    /*
     * On mobile hide all individual set columns, then display only the
     * last non-empty one. With the current HTML this is the current set.
     * This keeps the team/player area + sets won + current-set score only.
     */
    .set-score {
        display: none;
    }

    .set-score:not(:empty):not(:has(~ .set-score:not(:empty))) {
        display: table-cell;

        width: 31px;
        min-width: 31px;

        padding-left: 3px;
        padding-right: 3px;

        font-size: 13px;
        font-weight: 700;
        color: #27272a;
    }
}


/* Very small screens */

@media screen and (max-width: 380px) {
    .player-flag {
        width: 16px;
        height: 11px;
    }

    .player-line span,
    .player-name {
        font-size: 10px;
    }

    .sets-won {
        width: 26px;
        min-width: 26px;
        font-size: 16px;
    }

    .set-score:not(:empty):not(:has(~ .set-score:not(:empty))) {
        width: 28px;
        min-width: 28px;
        font-size: 12px;
    }
}
