html {
    -webkit-text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
}

img,
svg,
video,
canvas,
iframe {
    max-width: 100%;
    height: auto;
}

.main,
.card,
.cards,
.topbar,
.topbar-actions,
.grid-form,
.inline-actions,
.quick-filters,
.league-toolbar,
.league-grid,
.league-card,
.league-actions,
.gw-cards,
.auth-container,
.status-wrap {
    min-width: 0;
}

.main {
    max-width: 100%;
}

.card,
.auth-container {
    overflow: hidden;
}

.topbar,
.topbar-actions,
.inline-actions,
.quick-filters,
.league-actions,
.countdown-wrap,
.pagination {
    flex-wrap: wrap;
}

.topbar-actions {
    justify-content: flex-end;
}

.table-wrapper,
.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-wrapper .table,
.table-scroll .table {
    min-width: 640px;
}

.table td,
.table th {
    word-break: keep-all;
}

.sidebar {
    overscroll-behavior: contain;
}

@media (max-width: 1200px) {
    .main {
        padding: 20px;
    }

    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .league-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 992px) {
    body.sidebar-open {
        overflow: hidden;
    }

    body.sidebar-open::after {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(2, 6, 23, 0.58);
        z-index: 35;
    }

    .menu-toggle {
        display: inline-flex;
        flex: 0 0 auto;
    }

    .sidebar {
        width: min(320px, 86vw);
        height: 100dvh;
        transform: translateX(-100%);
        box-shadow: 24px 0 48px rgba(2, 6, 23, 0.45);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .main {
        width: 100%;
        margin-left: 0;
        padding: 18px 16px 28px;
    }

    .topbar {
        align-items: flex-start;
        gap: 14px;
    }

    .topbar-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .cards,
    .league-grid,
    .gw-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .main {
        padding: 14px 12px 24px;
    }

    .topbar h1 {
        font-size: 1.25rem;
    }

    .cards,
    .league-grid,
    .gw-cards,
    .grid-form,
    .league-toolbar {
        grid-template-columns: 1fr !important;
    }

    .topbar .pill,
    .topbar > div:last-child {
        max-width: 100%;
        white-space: normal;
    }

    .inline-actions > *,
    .quick-filters > *,
    .league-actions > * {
        flex: 1 1 100%;
    }

    .pagination {
        align-items: stretch;
    }

    .pagination .links {
        width: 100%;
        justify-content: space-between;
    }

    .table {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .table th,
    .table td {
        padding: 10px;
    }

    .auth-page {
        padding: 18px 12px;
    }

    .auth-container {
        width: 100%;
        padding: 22px 16px;
    }

    input,
    select,
    textarea,
    button,
    .btn {
        min-height: 44px;
    }
}

@media (max-width: 576px) {
    .main {
        padding: 12px 10px 22px;
    }

    .card {
        padding: 14px;
        border-radius: 12px;
    }

    .cards .card p {
        font-size: 1.25rem;
    }

    button,
    .btn,
    form button,
    form .btn,
    form input[type="submit"] {
        width: 100%;
    }

    .topbar-actions,
    .inline-actions,
    .quick-filters,
    .league-actions {
        width: 100%;
    }

    .wallet-topup {
        width: 36px;
        min-width: 36px;
        height: 36px;
        min-height: 36px;
    }

    .avatar {
        width: 36px;
        height: 36px;
    }
}
