/* Public tournament pages: keep desktop layouts and make live tables usable on phones. */
@media (max-width: 991.98px) {
    .public-tournament .container,
    .public-tournament .card,
    .public-tournament .group-container,
    .public-tournament .final-container {
        min-width: 0;
    }

    .public-tournament-group .group-container,
    .public-tournament-group .final-container {
        overflow-x: auto;
    }

    .public-tournament-group .group-container table,
    .public-tournament-group .final-container table {
        min-width: 540px;
    }

    .public-tournament-triple .round-container {
        max-width: 100%;
        overflow-x: auto;
    }

    .public-tournament-triple .matches-table {
        min-width: 700px;
    }
}

@media (max-width: 767.98px) {
    .public-tournament .container {
        width: 100%;
        max-width: 100%;
        padding-inline: 12px;
    }

    .public-tournament h1 {
        font-size: clamp(1.5rem, 6vw, 1.9rem);
        line-height: 1.2;
        overflow-wrap: anywhere;
    }

    .public-tournament h2 {
        font-size: 1.35rem;
    }

    .public-tournament .page-title-with-info {
        min-width: 0;
        gap: .4rem;
    }

    .public-tournament .page-title-with-info h1,
    .public-tournament .page-title-with-info h2 {
        min-width: 0;
        text-align: center;
    }

    .public-tournament .ranking-info-button {
        flex: 0 0 44px;
        width: 44px;
        height: 44px;
    }

    .public-tournament-group > .container {
        margin-top: 16px !important;
    }

    .public-tournament-group .row {
        margin-inline: 0;
    }

    .public-tournament-group .group-container {
        flex: 0 0 100%;
        max-width: 100%;
        padding: 14px;
        border-radius: 16px;
    }

    .public-tournament-group .final-container {
        padding: 14px;
        border-radius: 16px;
    }

    .public-tournament-group .btn-primary {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .public-tournament-triple .card {
        padding: 16px !important;
        border-radius: 16px;
    }

    .public-tournament-triple .card > .container {
        padding-inline: 0;
    }

    .public-tournament-triple .floating-button_ranking {
        position: static;
        display: block;
        width: fit-content;
        min-height: 44px;
        margin: 16px auto 24px;
        padding: 10px 24px;
    }
}

@media (max-width: 600px) and (orientation: portrait) {
    .public-tournament-group .group-container table,
    .public-tournament-group .final-container table,
    .public-tournament-triple .matches-table {
        min-width: 0;
        width: 100%;
        border: 0;
        background: transparent;
    }

    .public-tournament-group .group-container table tbody,
    .public-tournament-group .final-container table tbody,
    .public-tournament-triple .matches-table tbody {
        display: grid;
        gap: 8px;
    }

    .public-tournament-group .group-container table thead,
    .public-tournament-group .final-container table thead,
    .public-tournament-triple .matches-table thead {
        display: none;
    }

    .public-tournament-group .group-container table tr,
    .public-tournament-group .final-container table tr,
    .public-tournament-triple .matches-table tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 2rem .5rem 2rem minmax(0, 1fr);
        align-items: center;
        gap: .25rem;
        padding: 10px;
        border: 1px solid rgba(255, 255, 255, .12);
        border-radius: 12px;
        background: #17283a;
    }

    .public-tournament-group .group-container table td,
    .public-tournament-group .final-container table td,
    .public-tournament-triple .matches-table td {
        display: block;
        min-width: 0;
        padding: 2px !important;
        overflow-wrap: anywhere;
        border: 0 !important;
        background: transparent !important;
        color: #e8eef6;
        font-size: .84rem;
    }

    .public-tournament-group .group-container table td:nth-child(2),
    .public-tournament-triple .matches-table td:nth-child(1) {
        grid-column: 1;
        grid-row: 2;
    }

    .public-tournament-group .group-container table td:nth-child(3),
    .public-tournament-triple .matches-table td:nth-child(2) {
        grid-column: 2;
        grid-row: 2;
        text-align: center;
        font-weight: 700;
    }

    .public-tournament-group .group-container table td:nth-child(4),
    .public-tournament-triple .matches-table td:nth-child(3) {
        grid-column: 3;
        grid-row: 2;
        text-align: center;
    }

    .public-tournament-group .group-container table td:nth-child(5),
    .public-tournament-triple .matches-table td:nth-child(4) {
        grid-column: 4;
        grid-row: 2;
        text-align: center;
        font-weight: 700;
    }

    .public-tournament-group .group-container table td:nth-child(6),
    .public-tournament-triple .matches-table td:nth-child(5) {
        grid-column: 5;
        grid-row: 2;
        text-align: right;
    }

    .public-tournament-group [id$="-matches"] table td:first-child,
    .public-tournament-group #final-matches table td:first-child {
        grid-column: 1 / -1;
        grid-row: 1;
        color: #b9cbe0;
        text-align: left !important;
    }

    .public-tournament-group [id$="-matches"] table td:last-child,
    .public-tournament-triple .matches-table td:nth-child(n+6) {
        grid-row: 3;
        color: #b9cbe0;
        font-size: .78rem;
    }

    .public-tournament-group [id$="-matches"] table td:last-child {
        grid-column: 1 / -1;
    }

    .public-tournament-group [id$="-ranking"] table tr {
        grid-template-columns: 2rem minmax(0, 1fr) auto auto auto;
    }

    .public-tournament-group [id$="-ranking"] table td:first-child {
        grid-column: 1;
        grid-row: 1;
        color: #fbbf24;
        font-weight: 700;
    }

    .public-tournament-group [id$="-ranking"] table td:nth-child(2) {
        grid-column: 2;
        grid-row: 1;
        text-align: left;
        font-weight: 700;
    }

    .public-tournament-group [id$="-ranking"] table td:nth-child(n+3):nth-child(-n+5) {
        grid-row: 1;
    }

    .public-tournament-group [id$="-ranking"] table td:nth-child(n+6) {
        display: none;
    }

    .public-tournament-group #final-matches table td:nth-child(7) {
        grid-column: 1 / -1;
        grid-row: 3;
        color: #b9cbe0;
    }

    .public-tournament-group #final-matches table td:nth-child(7)::before {
        content: 'Race to: ';
    }

    .public-tournament-triple .matches-table td:nth-child(6) {
        grid-column: 1 / 3;
    }

    .public-tournament-triple .matches-table td:nth-child(6)::before {
        content: 'Race to: ';
    }

    .public-tournament-triple .matches-table td:nth-child(7) {
        grid-column: 3 / 5;
        text-align: center;
    }

    .public-tournament-triple .matches-table td:nth-child(7)::before {
        content: 'Tisch: ';
    }

    .public-tournament-triple .matches-table td:nth-child(8) {
        grid-column: 5;
        text-align: right;
    }

    .public-tournament-triple .matches-table .freilos-match td:first-child {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .public-tournament-triple .matches-table .freilos-match td:nth-child(2) {
        grid-column: 1 / -1;
        grid-row: 2;
        text-align: left;
    }

    .public-tournament-triple .matches-table .freilos-match td:nth-child(3),
    .public-tournament-triple .matches-table .freilos-match td:nth-child(4) {
        display: none;
    }
}
