/* Окна: общий каркас, поиск, провайдеры, языки, заглушки. Окна кабинета — в cabinet.css. На телефоне выезжают снизу. */

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 66px 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.modal__overlay {
    position: fixed;
    inset: 0;
    background: rgba(12, 5, 20, .72);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity .2s;
}
.modal__box {
    --modal-bg: #230e33;
    position: relative;
    width: 100%;
    max-width: 480px;
    padding: 20px;
    border-radius: var(--r-xl);
    background: var(--modal-bg);
    box-shadow: 0 24px 64px rgba(0, 0, 0, .5);
    opacity: 0;
    transform: translateY(12px) scale(.98);
    transition: opacity .2s cubic-bezier(.2, .8, .2, 1), transform .2s cubic-bezier(.2, .8, .2, 1);
}
.modal__box:focus { outline: 0; }
.modal.is-open .modal__overlay { opacity: 1; }
.modal.is-open .modal__box { opacity: 1; transform: none; }
/* Смена окна: затемнение сразу на месте, новая коробка лишь чуть проявляется. */
.modal.is-switch .modal__overlay { transition: none; }
.modal.is-switch .modal__box { transform: scale(.99); transition-duration: .12s; }
.modal.is-switch.is-open .modal__box { transform: none; }

.modal__box--wide { max-width: 640px; }
.modal__box--center { display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 400px; padding-top: 32px; text-align: center; }
/* Небольшие окна по центру, но если окно выше экрана — начинается сверху и прокручивается целиком. */
.modal--small .modal__box { margin-top: auto; margin-bottom: auto; }
/* Высокие окна (профиль, касса, баланс, настройки) как в оригинале: от 66 px сверху на всю высоту экрана, внутри прокрутка. */
.modal--sheet .modal__box { height: calc(100vh - 132px); margin-top: 0; margin-bottom: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.modal--sheet .modal__box::-webkit-scrollbar { display: none; }

.modal__head {
    position: sticky;
    top: -20px;
    z-index: 3;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin: -20px -20px 16px;
    padding: 20px 20px 0;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    background: var(--modal-bg);
}
.modal__title { font-family: var(--font-head); font-size: 32px; font-weight: 600; line-height: 32px; letter-spacing: -.56px; }
.modal__title--s { font-size: 24px; line-height: 28px; letter-spacing: -.4px; }
.modal__close {
    position: relative;
    display: grid;
    place-items: center;
    flex: none;
    width: 24px;
    height: 24px;
    color: var(--muted);
    transition: color .2s;
}
/* Крестик 24 px вровень с краем, но нажимается с запасом. */
.modal__close::before { content: ""; position: absolute; inset: -8px; }
.modal__close:hover { color: var(--text); }
.modal__close .icon { width: 20px; height: 20px; }
.modal__close--corner { position: absolute; top: 20px; right: 20px; }

/* вкладки */

.tabs { display: grid; grid-auto-columns: 1fr; grid-auto-flow: column; gap: 3px; padding: 2px; border-radius: 14px; background: rgba(188, 133, 255, .08); }
.tabs__item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 8px 16px;
    border-radius: var(--r);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    transition: background-color .2s;
}
.tabs__item:hover { background: rgba(188, 133, 255, .08); }
.tabs__item.is-active { background: rgba(188, 133, 255, .2); box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }

/* поле поиска */

.search-field {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 48px;
    margin-top: 16px;
    padding: 0 12px 0 16px;
    border: 1px solid transparent;
    border-radius: var(--r);
    background: var(--surface);
    transition: border-color .2s;
}
.search-field:focus-within { border-color: var(--accent); }
.search-field__icon { width: 20px; height: 20px; color: var(--muted); }
.search-field__input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: 0;
    background: none;
    font-size: 16px;
}
.search-field__input::placeholder { color: var(--muted); }
.search-field__input::-webkit-search-cancel-button { display: none; }
.search-field__clear { display: grid; place-items: center; width: 28px; height: 28px; color: var(--muted); }
.search-field__clear .icon { width: 20px; height: 20px; }

.tab-panel { margin-top: 24px; }
.search-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.search-head__title { font-family: var(--font-head); font-size: 20px; font-weight: 600; line-height: 24px; }
.games-grid--modal { --cols: 5; --gap: 12px; margin-top: 0; }

.search-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 40px 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 20px;
    text-align: center;
}
.search-empty b { color: var(--text); font-size: 16px; }
.search-empty__icon { width: 40px; height: 40px; margin-bottom: 8px; opacity: .6; }

/* провайдеры */

.provider-group + .provider-group { margin-top: 28px; }
.provider-group__label {
    display: inline-flex;
    align-items: center;
    height: 32px;
    margin-bottom: 12px;
    padding: 0 10px;
    border-radius: var(--r);
    background: var(--surface);
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
}
.provider-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.provider-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 88px;
    padding: 12px;
    border-radius: var(--r);
    background: var(--surface);
    transition: background-color .2s;
}
.provider-tile:hover { background: var(--surface-hover); }
.provider-tile__logo { display: grid; place-items: center; height: 36px; }
.provider-tile__logo img { width: auto; max-width: 140px; height: 36px; object-fit: contain; }
.provider-tile__name { overflow: hidden; max-width: 100%; font-size: 14px; font-weight: 600; line-height: 20px; text-overflow: ellipsis; white-space: nowrap; }

/* языки */

.lang-list { margin-bottom: 20px; }
.lang-list__item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 8px;
    border-radius: var(--r);
    text-align: left;
    transition: background-color .2s;
}
.lang-list__item:hover { background: var(--surface); }
.lang-list__item img { width: 32px; height: 32px; border-radius: 50%; }
.lang-list__item span { flex: 1; display: flex; flex-direction: column; }
.lang-list__item b { font-size: 16px; font-weight: 600; line-height: 22px; }
.lang-list__item small { color: var(--muted); font-size: 14px; line-height: 20px; }
.lang-list__code {
    display: grid !important;
    place-items: center;
    flex: none !important;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface);
    font-size: 11px;
    font-weight: 700;
}
.lang-list__check {
    position: relative;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #5a9bff;
}
.lang-list__check::after {
    content: "";
    position: absolute;
    top: 6px;
    left: 8px;
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* заглушки */

.stub__img { width: 96px; height: 96px; margin-bottom: 4px; border-radius: 24px; object-fit: cover; }
.stub__img--game { width: 132px; height: 176px; border-radius: var(--r-m); }
.stub__badge {
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(53, 236, 144, .14);
    color: var(--green);
    font-size: 12px;
    font-weight: 600;
    line-height: 16px;
}
.stub__title { font-family: var(--font-head); font-size: 22px; font-weight: 700; line-height: 28px; }
.stub__text { color: var(--muted); font-size: 14px; line-height: 20px; }
.modal__box--center .btn { min-width: 160px; margin-top: 8px; }

/* телефон: окна выезжают снизу */

/* Телефон: окно — лист на всю высоту экрана от 24 px сверху, как в оригинале. Заглушки — небольшой лист снизу. */
@media (max-width: 1023px) {
    .modal { padding: 24px 0 0; }
    .modal__box,
    .modal--small .modal__box {
        max-width: none;
        min-height: calc(100vh - 24px);
        min-height: calc(100dvh - 24px);
        margin: 0;
        padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
        border-radius: var(--r-xl) var(--r-xl) 0 0;
        transform: translateY(40px);
    }
    .modal__head,
    .modal--small .modal__head { top: -16px; margin: -16px -16px 14px; padding: 16px 16px 0; }
    .modal__box--center,
    .modal--small .modal__box--center { min-height: 0; margin-top: auto; padding-top: 40px; }
    .modal__close--corner { top: 16px; right: 16px; }
    .modal__title { font-size: 22px; line-height: 24px; letter-spacing: -.4px; }
    .modal__title--s { font-size: 22px; line-height: 24px; }
    .games-grid--modal { --cols: 3; --gap: 8px; }
    .provider-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
