:root {
    --game-bg: #171719;
    --game-panel: #24232d;
    --game-panel-2: #302f3a;
    --game-text: #f6f5f8;
    --game-muted: #aaa8b0;
    --game-border: rgba(255, 255, 255, 0.11);
    --game-accent: var(--client-accent, #ff7200);
    --game-danger: #ff335f;
}

[data-theme="light"] {
    --game-bg: #f4f2f6;
    --game-panel: #ffffff;
    --game-panel-2: #ece9f0;
    --game-text: #23212a;
    --game-muted: #716d78;
    --game-border: rgba(35, 33, 42, 0.12);
}

.client-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.section-category {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 6px;
    padding: 10px 12px;
    background: var(--game-bg);
}

.section-category .category-scroll {
    min-width: 0;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
}

.section-category .category-scroll::-webkit-scrollbar {
    display: none;
}

.section-category .category-track {
    display: flex;
    gap: 8px;
    width: max-content;
}

.section-category .category-item {
    position: relative;
    display: flex;
    flex: 0 0 92px;
    min-height: 88px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    color: var(--game-text);
    font: inherit;
    font-size: 14px;
    line-height: 1.1;
    white-space: nowrap;
    border: 1px solid transparent;
    border-radius: 13px;
    background: var(--game-panel-2);
    cursor: pointer;
    scroll-snap-align: start;
    transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.section-category .category-item:hover {
    transform: translateY(-2px);
}

.section-category .category-item.active {
    color: #fff;
    border-color: var(--game-accent);
    box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--game-accent) 70%, transparent);
}

.section-category .category-item .icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    font-size: 32px;
    line-height: 1;
}

.section-category .category-item .icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.section-category .nav-btn {
    z-index: 2;
    width: 25px;
    padding: 0;
    color: var(--game-muted);
    border: 0;
    background: transparent;
    cursor: pointer;
}

.section-game {
    padding: 4px 12px 24px;
    color: var(--game-text);
    background: var(--game-bg);
}

.game-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 0;
}

.game-section-head h2 {
    position: relative;
    margin: 0;
    padding-left: 14px;
    color: var(--game-text);
    font-size: clamp(20px, 4vw, 28px);
    line-height: 1.15;
}

.game-section-head h2::before {
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 0;
    width: 6px;
    border-radius: 10px;
    background: var(--game-accent);
    content: '';
}

.game-section-head p {
    margin: 4px 0 0 14px;
    color: var(--game-muted);
    font-size: 12px;
}

.game-search {
    display: flex;
    width: min(230px, 40vw);
    align-items: center;
    gap: 7px;
    padding: 8px 10px;
    color: var(--game-muted);
    border: 1px solid var(--game-border);
    border-radius: 999px;
    background: var(--game-panel);
}

.game-search input {
    width: 100%;
    min-width: 0;
    padding: 0;
    color: var(--game-text);
    font: inherit;
    font-size: 13px;
    border: 0;
    outline: 0;
    background: transparent;
}

.game-search input::placeholder {
    color: var(--game-muted);
}

.game-browser-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    align-items: start;
}

.game-browser-layout.has-provider-sidebar {
    grid-template-columns: 98px minmax(0, 1fr);
}

.provider-sidebar {
    position: sticky;
    top: 70px;
    max-height: calc(100vh - 145px);
    overflow-y: auto;
    border-right: 1px solid var(--game-border);
    scrollbar-width: none;
}

.provider-sidebar::-webkit-scrollbar {
    display: none;
}

.provider-list {
    display: grid;
    gap: 5px;
    padding-right: 7px;
}

.provider-item {
    position: relative;
    display: flex;
    min-height: 91px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 4px;
    overflow: hidden;
    color: var(--game-muted);
    font: inherit;
    border: 1px solid transparent;
    border-radius: 10px;
    background: var(--game-panel);
    cursor: pointer;
}

.provider-item.active {
    color: #fff;
    border-color: color-mix(in srgb, var(--game-accent) 70%, transparent);
    background: linear-gradient(145deg, color-mix(in srgb, var(--game-accent) 28%, var(--game-panel)), var(--game-panel));
}

.provider-item.active::after {
    position: absolute;
    top: 50%;
    right: -1px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 0;
    border-left: 8px solid var(--game-accent);
    content: '';
    transform: translateY(-50%);
}

.provider-logo {
    display: grid;
    width: 55px;
    height: 34px;
    place-items: center;
    font-size: 28px;
    line-height: 1;
}

.provider-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.provider-name {
    display: -webkit-box;
    max-width: 100%;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.2;
    text-align: center;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.provider-item small {
    position: absolute;
    top: 5px;
    right: 5px;
    min-width: 18px;
    padding: 1px 4px;
    color: #fff;
    font-size: 9px;
    border-radius: 999px;
    background: var(--game-accent);
}

.game-results {
    min-width: 0;
}

.game-load-status {
    min-height: 0;
    color: var(--game-muted);
    font-size: 12px;
    text-align: center;
}

.section-game .game-part {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.section-game .has-provider-sidebar .game-part {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.section-game .game-item {
    min-width: 0;
    list-style: none;
}

.game-card {
    display: block;
    min-width: 0;
    color: var(--game-text);
    text-decoration: none;
}

.game-cover {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border: 1px solid var(--game-border);
    border-radius: 14px;
    background: var(--game-panel);
    transition: border-color 0.2s ease, transform 0.2s ease;
}

#gameBrowser[data-active-category="casino"] .game-cover {
    aspect-ratio: 0.82 / 1;
}

.game-card:hover .game-cover {
    border-color: color-mix(in srgb, var(--game-accent) 65%, transparent);
    transform: translateY(-2px);
}

.game-cover > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.game-name {
    display: block;
    margin-top: 6px;
    overflow: hidden;
    color: var(--game-muted);
    font-size: 13px;
    line-height: 1.25;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.game-provider {
    position: absolute;
    top: 5px;
    right: 6px;
    max-width: 60%;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.88);
    font-size: 10px;
    font-weight: 800;
    text-shadow: 0 1px 3px #000;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.game-badge,
.game-cashback,
.game-maintenance {
    position: absolute;
    z-index: 2;
    padding: 3px 5px;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
    border-radius: 4px;
}

.game-badge {
    top: 6px;
    left: 6px;
}

.badge-new {
    background: #ff3b24;
}

.badge-hot {
    background: var(--game-accent);
}

.game-cashback {
    bottom: 5px;
    left: 5px;
    background: rgba(174, 86, 31, 0.9);
}

.game-maintenance {
    top: 50%;
    left: 50%;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.76);
    transform: translate(-50%, -50%);
}

.game-card.is-maintenance .game-cover > img {
    filter: grayscale(0.8) brightness(0.55);
}

.game-favorite {
    position: absolute;
    z-index: 3;
    right: 6px;
    bottom: 6px;
    display: grid;
    width: 29px;
    height: 29px;
    place-items: center;
    padding: 0;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    background: rgba(21, 21, 24, 0.48);
    cursor: pointer;
}

.game-favorite.active {
    color: #fff;
    border-color: var(--game-accent);
    background: var(--game-accent);
}

.game-favorite:disabled {
    opacity: 0.55;
    cursor: wait;
}

.game-empty {
    display: grid;
    min-height: 230px;
    place-items: center;
    align-content: center;
    gap: 7px;
    color: var(--game-muted);
    border: 1px dashed var(--game-border);
    border-radius: 16px;
    background: var(--game-panel);
    text-align: center;
}

.game-empty[hidden] {
    display: none;
}

.game-empty > span {
    font-size: 42px;
}

.game-empty strong {
    color: var(--game-text);
}

.game-empty button,
.game-load-more {
    padding: 9px 18px;
    color: #fff;
    font: inherit;
    font-weight: 700;
    border: 0;
    border-radius: 999px;
    background: var(--game-accent);
    cursor: pointer;
}

.game-load-more {
    display: block;
    min-width: 130px;
    margin: 20px auto 0;
}

.game-load-more[hidden] {
    display: none;
}

.game-skeleton .skeleton-cover,
.game-skeleton .skeleton-line {
    display: block;
    overflow: hidden;
    background: var(--game-panel);
}

.game-skeleton .skeleton-cover {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 14px;
}

.game-skeleton .skeleton-line {
    width: 72%;
    height: 10px;
    margin: 8px auto 0;
    border-radius: 10px;
}

.game-skeleton .skeleton-cover::after,
.game-skeleton .skeleton-line::after {
    display: block;
    width: 45%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.09), transparent);
    content: '';
    animation: game-shimmer 1.1s infinite;
}

@keyframes game-shimmer {
    from { transform: translateX(-120%); }
    to { transform: translateX(320%); }
}

.client-toast-stack {
    position: fixed;
    z-index: 10000;
    top: 74px;
    left: 50%;
    display: grid;
    width: min(92vw, 390px);
    gap: 8px;
    pointer-events: none;
    transform: translateX(-50%);
}

.client-toast {
    padding: 11px 14px;
    color: #fff;
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    background: #2e2c36;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.client-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.client-toast.is-success { border-color: #30bd73; }
.client-toast.is-warning { border-color: var(--game-accent); }
.client-toast.is-error { border-color: var(--game-danger); }

@media (min-width: 900px) {
    .section-game .game-part {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .section-game .has-provider-sidebar .game-part {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .section-category {
        padding-inline: 8px;
    }

    .section-category .category-item {
        flex-basis: 77px;
        min-height: 77px;
        font-size: 12px;
        border-radius: 11px;
    }

    .section-category .category-item .icon {
        width: 34px;
        height: 34px;
        font-size: 27px;
    }

    .section-game {
        padding-inline: 8px;
    }

    .game-section-head {
        align-items: flex-end;
    }

    .game-section-head p {
        display: none;
    }

    .game-search {
        width: 42vw;
        padding: 7px 9px;
    }

    .game-browser-layout.has-provider-sidebar {
        grid-template-columns: 80px minmax(0, 1fr);
        gap: 7px;
    }

    .provider-list {
        padding-right: 5px;
    }

    .provider-item {
        min-height: 81px;
        padding-inline: 2px;
    }

    .provider-logo {
        width: 46px;
        height: 29px;
    }

    .provider-name {
        font-size: 10px;
    }

    .section-game .game-part {
        gap: 10px 7px;
    }

    .game-cover {
        border-radius: 11px;
    }

    .game-name {
        margin-top: 4px;
        font-size: 11px;
    }

    .game-favorite {
        width: 25px;
        height: 25px;
        right: 4px;
        bottom: 4px;
        font-size: 17px;
    }
}

@media (max-width: 370px) {
    .section-game .game-part,
    .section-game .has-provider-sidebar .game-part {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .game-search {
        width: 44vw;
    }
}

@media (prefers-reduced-motion: reduce) {
    .category-item,
    .game-cover,
    .client-toast {
        transition: none !important;
    }

    .game-skeleton .skeleton-cover::after,
    .game-skeleton .skeleton-line::after {
        animation: none;
    }
}
