/* LAYOUT */

    .casino-layout {
        display: flex;
        min-height: 100dvh;
    }

    .casino-content{
        min-width: 0;
        flex: 1;
        overflow: hidden;
    }

    .casino-content__main {
        display: flex;
        flex-direction: column;
        margin: 0 30px;
        min-height: calc(100dvh - calc(100px + env(safe-area-inset-top)));
    }

    /* SIDEBAR */

    .casino-sidebar {
        width: 272px;
        background: var(--casino_menu_bg);
        color: var(--casino_menu_color);
        padding: 20px 0;
        padding-top: 10px;
        position: sticky;
        top: 10px;
        margin-left: 10px;
        height: calc(100dvh - 20px);
        min-height: calc(100dvh - 20px);
        border-radius: var(--main_radius);
        overflow-y: hidden;
    }
    .casino-sidebar__content{
        height: calc(100% - 52px);
        overflow-y: auto
    }
    .casino-sidebar__content::-webkit-scrollbar {
        width: 4px;
    }
    .casino-sidebar__content::-webkit-scrollbar-track {
        background: var(--casino_menu_bg);
        border-radius: 0;
    }
    .casino-sidebar__content::-webkit-scrollbar-thumb {
        border-radius: 50px;
        border: 0 solid rgba(0, 0, 0, 0);
        background: var(--scrollbar_block_color);
    }

    .casino-sidebar__header {
        padding: 12px 20px;
        font-size: 12px;
        color: #666;
        font-weight: 600;
    }

    .casino-sidebar__item {
        position: relative;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: space-between;
        transition: background 0.2s;
        color: var(--casino_menu_color);
        text-decoration: none;
        padding: 8px 20px;
        margin-bottom: 4px;
        line-height: 20px;
        transition: color .2s ease-in-out;
    }

    .casino-sidebar__item:hover {
        color: var(--header_active);
    }

    .casino-sidebar__item--active {
        color: var(--header_active);
    }

    .casino-sidebar__item--active::before {
        content: "";
        position: absolute;
        background: var(--header_active);
        left: 0;
        width: 3px;
        height: 100%;
        border-top-right-radius: 5px;
        border-bottom-right-radius: 5px;
    }

    .casino-sidebar__item-text {
        display: flex;
        align-items: center;
    }

    .casino-sidebar__item-icon {
        width: 24px;
        height: 24px;
        background-size: 20px;
        background-position: center;
        background-repeat: no-repeat;
        margin-right: 8px;
    }

    .casino-sidebar__item-count {
        padding: 2px 8px;
        border-radius: 4px;
        font-size: 12px;
        opacity: .6;
    }

    .casino-sidebar__separator {
        height: 1px;
        background: rgba(138, 202, 255, 0.12);
        margin: 12px;
    }

    .casino-sidebar__search-container{
        padding: 6px 12px;
    }   

    .casino-sidebar__search-btn {
        flex: 4;
        display: flex;
        gap: 12px;
        align-items: center;
        background: #1f2941;
        color: #888888;
        border-radius: var(--main_radius);
        width: 100%;
        height: 40px;
        padding: 0px 16px;
        cursor: pointer;

    }

    /* TOP TOOLBAR: SEARCH + PROVIDERS */

    .casino-toolbar {
        display: flex;
        gap: 8px;
        align-items: center;
        margin-bottom: 15px;
    }

    .casino-toolbar__search-btn {
        flex: 4;
        display: flex;
        gap: 12px;
        align-items: center;
        background: var(--casino_menu_bg);
        color: var(--casino_menu_color);
        border-radius: var(--main_radius);
        width: 100%;
        height: 44px;
        padding: 0px 16px;
        cursor: pointer;
        opacity: .8;
        transition: opacity .2s ease-in-out;
    }

    .casino-toolbar__search-btn:hover {
        opacity: 1;
    }

    .casino-toolbar__providers-btn {
        flex: 1;
        width: 100%;
        height: 44px;
        line-height: 44px;
        background: var(--casino_menu_bg);
        color: var(--casino_menu_color);
        border-radius: var(--main_radius);
        padding: 0px 16px;
        opacity: .8;
        transition: opacity .2s ease-in-out;
    }

    .casino-toolbar__providers-selected {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .casino-toolbar__providers-label {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-weight: 600;
    }

    .casino-toolbar__providers-clear {
        width: 25px;
        height: 25px;
        background-image: url(/img/modal_close.svg);
        background-size: 50%;
        background-repeat: no-repeat;
        background-position: center center;
    }

    .casino-toolbar__providers-clear:hover {
        opacity: 1;
    }

    /* TOP TABS */

    .casino-tabs {
        display: flex;
        gap: 8px;
        margin-bottom: 30px;
        overflow-x: hidden;
        padding-bottom: 10px;
        overflow: hidden;
    }

    .casino-tabs__item {
        width: auto;    
        padding: 12px 16px;
        background: var(--casino_menu_bg);
        border-radius: var(--main_radius);
        cursor: pointer;
        white-space: nowrap;
        text-decoration: none;
        color: #fff;
        opacity: .8;
        transition: opacity .2s ease-in-out, background .2s ease-in-out;
    }

    .casino-tabs__icon {
        width: 20px;
        height: 20px;
        margin: 0 auto;
        margin-bottom: 8px;
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
    }

    .casino-tabs__item:hover {
        opacity: 1;
    }

    .casino-tabs__item--active {
        background: #2a5bd7;
        opacity: 1;
    }

    /* SECTION HEADER (title + "Все игры") */

    .casino-section__header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
    }

    .casino-section__title {
        font-size: 20px;
        font-weight: 600;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .casino-section__title img {
        width: 32px;
        height: 32px;
    }

    .casino-section__view-all-btn {
        padding: 8px 16px;
        background: transparent;
        border: 1px solid #333;
        border-radius: var(--main_radius);
        color: #fff;
        cursor: pointer;
        transition: all 0.2s;
    }

    .casino-section__view-all-btn:hover {
        background: #252b35;
        border-color: #2a5bd7;
    }

    /* GAMES GRID */

    .casino-games__grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 15px;
        margin-bottom: 40px;
        overflow: hidden;
    }

    .casino-games__placeholder {
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        color: #666;
        text-align: center;
        padding: 10px;
        background: linear-gradient(135deg, #1a1f26, #252b35);
    }

    .casino-games__overlay {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.85);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 10px;
        opacity: 0;
        transition: opacity 0.3s;
        padding: 20px;
    }

    .casino-games__info {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 10px;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
        text-align: center;
    }

    .casino-games__title {
        font-size: 14px;
        font-weight: 600;
        margin-bottom: 4px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .casino-games__provider {
        font-size: 11px;
        color: #999;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
    }

    /* SEARCH MODAL */

    #casino-search .casino-search__content {
        display: flex;
        flex-direction: column;
    }

    #casino-search .casino-games__grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .casino-search__input-container {
        margin-bottom: 15px;
    }

    .casino-search__input {
        width: 100%;
        padding: 12px 40px 12px 16px;
        background: #252b35;
        border: none;
        border-radius: 8px;
        color: #fff;
        font-size: 16px;
    }

    .casino-search__input::placeholder {
        color: #666;
    }

    .casino-search__results {
        margin-right: -20px;
        padding-right: 20px;
        overflow-y: auto;
        flex: 1;
    }

    .casino-search__section {
        margin-bottom: 30px;
    }

    .casino-search__section .casino-games__grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .casino-search__section-title {
        font-size: 14px;
        font-weight: 600;
        color: #666;
        margin-bottom: 15px;
    }

    .casino-search__providers-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }

    .casino-search__provider-card {
        background: rgba(169, 172, 180, 0.12);
        padding: 20px;
        border-radius: 8px;
        text-align: center;
        cursor: pointer;
        transition: background 0.2s;
        position: relative;
    }

    .casino-search__provider-logo {
        width: 30px;
        height: 30px;
        margin-bottom: 8px;
    }

    .casino-search__provider-name {
        font-size: 14px;
        color: #999;
        font-weight: 600;
    }

    .casino-search__loading {
        text-align: center;
        padding: 40px;
        color: #666;
    }

    /* GAME FRAME PAGE */

    .casino-game-frame {
        min-height: calc(100dvh - calc(100px + env(safe-area-inset-top)));
        z-index: 999;
        display: flex;
        flex-direction: column;
    }

    .casino-game-frame__header {
        display: flex;
        align-items: center;
        gap: 15px;
        margin-bottom: 15px;
        padding-top: max(constant(safe-area-inset-top), 0);
        padding-top: max(env(safe-area-inset-top), 0);
    }

    .casino-game-frame__title {
        flex: 1;
        font-weight: 600;
    }

    .casino-game-frame__balance {
        display: none;
    }

    .casino-game-frame__balance-value {
        text-align: right;
        min-width: 70px;
        font-weight: 600;
    }

    .casino-game-frame__btn {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px 12px;
        background: var(--casino_interface_bg);
        color: var(--casino_interface_color);
        border: none;
        border-radius: var(--main_radius);
        color: #fff;
        cursor: pointer;
        opacity: .8;
        transition: opacity 0.2s;
    }

    .casino-game-frame__btn svg {
        width: 16px;
        height: 16px;
    }

    .casino-game-frame__btn:hover {
        opacity: 1;
    }

    .casino-game-frame__body {
        flex: 1;
        position: relative;
        height: 100%;
        border: none;
        background: #000;
        border-radius: var(--main_radius);
        overflow: hidden;
    }

    .casino-game-frame__body *:first-child {
        position: absolute;
        height: 100%;
        width: 100%;
        top: 0;
    }

    /* SCROLLBARS IN MODAL */

    .modal * {
        --sb-track-color: #e7e7e7;
        --sb-thumb-color: #b5b5b5;
        --sb-size: 6px;
    }

    .modal *::-webkit-scrollbar {
        width: var(--sb-size);
    }

    .modal *::-webkit-scrollbar-track {
        background: var(--sb-track-color);
        border-radius: 8px;
    }

    .modal *::-webkit-scrollbar-thumb {
        background: var(--sb-thumb-color);
        border-radius: 8px;
    }

    @supports not selector(::-webkit-scrollbar) {
        .modal * {
            scrollbar-color: var(--sb-thumb-color) var(--sb-track-color);
        }
    }

    /* RESPONSIVE */

    @media (max-width: 1440px) {
        .page.game .casino-sidebar{
            display: none;
        }
    }

    @media (max-width: 1000px) {
        .casino-sidebar {
            display: none;
        }
        .casino-tabs{
            overflow: visible
        }

        .casino-layout__main {
            margin: 0;
            padding: 12px;
            height: 100%;
        }

        .page.game .casino-layout__main {
            padding: 0;
        }

        .casino-toolbar{
            margin-bottom: 8px;
        }

        .casino-toolbar__search-btn,
        .casino-toolbar__providers-btn {
            flex: 1;
        }

        .casino-games__grid {
            grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
            gap: 10px;
        }

        .casino-search__providers-grid {
            grid-template-columns: repeat(2, 1fr);
        }

        .casino-game-frame {
            left: 0;
            height: 100%;
        }

        .casino-game-frame__balance {
            display: flex;
            align-items: center;
            gap: 5px;
            background-color: #000000;
            color: #fff;
            border-radius: var(--main_radius);
            padding: 2px;
            padding-left: 10px;
        }

        .casino-game-frame__balance .menu-button{
            height: 28px;
            line-height: 28px;
            padding: 0px 10px;
            border-radius: calc(var(--main_radius) - 2px);
        }
        .casino-game-frame__header {
            justify-content: space-between;
            margin-bottom: 0;
            padding: 12px;
            padding-top: max(env(safe-area-inset-top), 12px);
        }

        .casino-game-frame__title--hidden {
            display: none;
        }

        .casino-game-frame__btn:nth-child(2) {
            display: none;
        }
        .casino-game-frame__btn:nth-child(3) {
            display: none;
        }

        .casino-game-frame__body {
            min-height: calc(100dvh - calc(62px + env(safe-area-inset-top)));
            border-radius: 0;
        }
    }

    @media (max-width: 768px) {
        .casino-games__grid {
            grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
            gap: 10px;
        }
    }