/* Каркас: боковое меню, шапка, содержимое, подвал, нижняя панель телефона. */

/* ---------- боковое меню ---------- */

.sidebar {
    position: fixed;
    top: 12px;
    bottom: 12px;
    left: 8px;
    z-index: 40;
    display: flex;
    flex-direction: column;
    width: var(--side);
    border-radius: var(--r-l);
    background: var(--panel);
    transition: width .25s ease;
}

.sidebar__head {
    position: relative;
    padding: 16px 16px 15px;
    border-bottom: 1px solid var(--line);
}

.online {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 14px;
    line-height: 20px;
}
.online__label { color: var(--muted); }
.online__value {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}
.online__short { display: none; }
.online--inline { justify-content: flex-end; }

.sidebar__toggle {
    position: absolute;
    top: 48px;
    right: -16px;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--panel);
    box-shadow: 0 0 0 4px var(--bg);
    color: var(--muted);
    transition: color .2s;
}
.sidebar__toggle:hover { color: var(--text); }
.sidebar__toggle .icon { width: 20px; height: 20px; transform: rotate(180deg); transition: transform .25s; }

.sidebar__scroll {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
    padding: 16px 16px 8px;
    overflow-y: auto;
    scrollbar-width: none;
}
.sidebar__scroll::-webkit-scrollbar { display: none; }
.sidebar__scroll > * { flex-shrink: 0; }

.profile {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    text-align: left;
}
.avatar {
    position: relative;
    display: grid;
    place-items: center;
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--surface);
    color: #bc85ff;
}
.avatar .icon { width: 24px; height: 24px; }
.avatar__dot {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    border: 2px solid var(--panel);
    border-radius: 50%;
    background: var(--lime);
}
.profile__text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.profile__name { overflow: hidden; font-size: 16px; line-height: 24px; text-overflow: ellipsis; white-space: nowrap; }
.profile__id { color: var(--muted); font-size: 12px; line-height: 16px; }
.profile__arrow { color: var(--muted); width: 20px; height: 20px; }

.segment { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segment__item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 8px 12px;
    border-radius: var(--r);
    background: var(--surface);
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    transition: background-color .2s;
}
.segment__item:hover { background: var(--surface-hover); }
.segment__item.is-active { background: var(--grad); color: #fff; }
.segment__item .icon { width: 20px; height: 20px; }

.wheel-link {
    position: relative;
    display: flex;
    align-items: center;
    height: 56px;
    padding: 0 16px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: linear-gradient(90deg, rgba(48, 36, 71, 0) 0%, rgba(48, 36, 71, .9) 64%, #302447 100%);
    font-size: 12px;
    font-weight: 600;
    line-height: 16px;
}
.wheel-link__img {
    position: absolute;
    right: -8px;
    bottom: -16px;
    width: 64px;
    height: 64px;
    transition: transform .4s ease;
}
.wheel-link:hover .wheel-link__img { transform: rotate(45deg); }

.side-nav__group { padding: 4px 0; }
.side-nav__group + .side-nav__group { border-top: 1px solid var(--line); }
.side-nav__link {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 40px;
    padding: 0 8px;
    border-radius: var(--r-s);
    font-size: 14px;
    line-height: 20px;
    transition: background-color .2s, color .2s;
}
.side-nav__link .icon { width: 20px; height: 20px; color: var(--muted); transition: color .2s; }
.side-nav__link:hover, .side-nav__link.is-active { background: var(--surface); }
.side-nav__link:hover .icon, .side-nav__link.is-active .icon { color: var(--text); }
.side-nav__text { flex: 1; }

.sidebar__bottom { display: flex; flex-direction: column; gap: 8px; padding: 8px 16px 16px; }

.pwa {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 80px;
    padding: 0 12px 0 92px;
    overflow: hidden;
    border-radius: var(--r-m);
    background: linear-gradient(90deg, #c45cff 0%, #9a2ff0 100%);
    color: #fff;
    text-align: left;
}
.pwa__img { position: absolute; left: 0; bottom: 0; width: 88px; height: 80px; object-fit: cover; object-position: left bottom; }
.pwa__text { flex: 1; display: flex; flex-direction: column; font-size: 12px; line-height: 16px; }
.pwa__text b { font-size: 14px; line-height: 18px; }
.pwa__icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: var(--r-s);
    background: rgba(255, 255, 255, .2);
}
.pwa__icon .icon { width: 20px; height: 20px; }

.sidebar__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.socials { display: flex; gap: 8px; }
.social { display: block; width: 36px; height: 36px; transition: filter .2s; }
.social:hover { filter: brightness(1.12); }
.social .icon { width: 100%; height: 100%; }

.lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 8px;
    border-radius: var(--r-s);
    background: var(--surface);
    font-size: 14px;
    line-height: 20px;
    transition: background-color .2s;
}
.lang-btn:hover { background: var(--surface-hover); }
.lang-btn__flag { width: 24px; height: 24px; border-radius: 50%; }
.lang-btn__arrow { color: var(--muted); }

.support-link {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 8px 0 16px;
    border-radius: var(--r-s);
    background: var(--surface);
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    transition: background-color .2s;
}
.support-link:hover { background: var(--surface-hover); }
.support-link__icon { display: none; width: 20px; height: 20px; }
.support-link__text { flex: 1; text-align: left; }

/* Свёрнутое меню на компьютере: остаются иконки. */
@media (min-width: 1024px) {
    .is-collapsed .sidebar { width: var(--side-mini); }
    .is-collapsed .sidebar__toggle .icon { transform: none; }
    .is-collapsed .sidebar__head { padding: 14px 8px; }
    .is-collapsed .online { flex-direction: column; gap: 4px; }
    .is-collapsed .online__label,
    .is-collapsed .online__full,
    .is-collapsed .profile__text,
    .is-collapsed .profile__arrow,
    .is-collapsed .segment__item span,
    .is-collapsed .wheel-link__text,
    .is-collapsed .side-nav__text,
    .is-collapsed .side-nav__link .badge,
    .is-collapsed .pwa__text,
    .is-collapsed .pwa__icon,
    .is-collapsed .lang-btn__code,
    .is-collapsed .lang-btn__arrow,
    .is-collapsed .support-link__text,
    .is-collapsed .support-link .badge { display: none; }
    .is-collapsed .online__short { display: inline; font-size: 12px; }
    .is-collapsed .online__value { flex-direction: column; gap: 6px; }
    .is-collapsed .sidebar__scroll,
    .is-collapsed .sidebar__bottom { align-items: center; padding-left: 8px; padding-right: 8px; }
    .is-collapsed .profile { justify-content: center; }
    .is-collapsed .segment { grid-template-columns: 1fr; width: 40px; }
    .is-collapsed .segment__item { padding: 0; }
    .is-collapsed .wheel-link { width: 40px; height: 40px; padding: 0; border-radius: 50%; }
    .is-collapsed .wheel-link__img { inset: -4px; width: 48px; height: 48px; }
    .is-collapsed .side-nav__link { justify-content: center; width: 40px; padding: 0; }
    .is-collapsed .pwa { width: 52px; height: 60px; padding: 0; border-radius: var(--r); }
    .is-collapsed .pwa__img { width: 100%; height: 100%; }
    .is-collapsed .sidebar__row { flex-direction: column; }
    .is-collapsed .socials { gap: 4px; }
    .is-collapsed .social { width: 24px; height: 24px; }
    .is-collapsed .lang-btn { width: 52px; justify-content: center; }
    .is-collapsed .support-link { justify-content: center; width: 52px; padding: 0; }
    .is-collapsed .support-link__icon { display: block; }
}

/* ---------- страница и шапка ---------- */

.page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin-left: calc(var(--side) + 8px);
    padding: 0 var(--pad);
    transition: margin-left .25s ease;
}
.is-collapsed .page { margin-left: calc(var(--side-mini) + 8px); }

.main { flex: 1; min-width: 0; }

.header {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 84px;
}

.logo { display: block; flex: none; }
.logo__wide { width: 151px; height: 44px; object-fit: contain; object-position: left center; }
.logo__square { display: none; width: 40px; height: 40px; border-radius: 10px; }

.balance {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 44px;
    margin: 0 auto;
    padding: 4px 4px 4px 12px;
    border-radius: var(--r);
    background: var(--surface);
}
.balance__sum {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
}
.balance__currency { width: 24px; height: 24px; }
.balance__arrow { color: var(--muted); }
.balance__deposit { height: 36px; padding: 0 16px; border-radius: var(--r-s); }

.header__auth { display: flex; gap: 8px; margin-left: auto; }

/* ---------- плашка приложения (телефон) ---------- */

.app-banner {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 14px 10px;
    border-bottom: 1px solid var(--line);
    background: #241431;
}
.app-banner__close { display: grid; place-items: center; width: 28px; height: 28px; color: var(--muted); }
.app-banner__close .icon { width: 18px; height: 18px; }
.app-banner__logo { width: 48px; height: 48px; border-radius: 12px; }
.app-banner__info { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.app-banner__title { font-size: 15px; font-weight: 600; line-height: 20px; }
.app-banner__rating { color: var(--muted); font-size: 12px; line-height: 16px; }
.app-banner__stars { color: #ffc93c; letter-spacing: 1px; }
.app-banner__badge { padding: 2px 8px; border-radius: 999px; background: var(--surface); font-size: 11px; line-height: 16px; }
.app-banner__action { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.app-banner__note { color: var(--muted); font-size: 11px; line-height: 14px; }

/* ---------- нижняя панель (телефон) ---------- */

.tabbar { display: none; }
.menu-overlay { display: none; }

/* ---------- подвал ---------- */

.footer { padding: 40px 0 24px; }

.footer__card {
    display: grid;
    grid-template-columns: 1fr 292px;
    gap: 40px 32px;
    padding: 32px;
    border-radius: var(--r-xl);
    background: var(--panel);
}

.footer__main { display: flex; flex-direction: column; gap: 32px; }
.footer__top { display: flex; align-items: center; gap: 16px; }
.footer__line { flex: 1; height: 1px; background: var(--line); }

.footer__links { display: grid; grid-template-columns: 200px 1fr; gap: 24px; }
.footer__title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    font-family: var(--font-head);
    font-size: 18px;
    font-weight: 600;
    line-height: 24px;
    list-style: none;
    cursor: default;
}
.footer__title::-webkit-details-marker { display: none; }
.footer__chevron { display: none; width: 20px; height: 20px; color: var(--muted); transition: transform .2s; }
.footer__list { display: flex; flex-direction: column; gap: 12px; }
.footer__list--2 { display: grid; grid-template-columns: repeat(2, minmax(0, 140px)); }
.footer__list a { color: var(--muted); font-size: 14px; line-height: 20px; transition: color .2s; }
.footer__list a:hover { color: var(--text); }

.footer__side { display: flex; flex-direction: column; gap: 24px; }

.support-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    min-height: 188px;
    padding: 16px 130px 16px 16px;
    overflow: hidden;
    border-radius: var(--r-m);
    background: linear-gradient(110deg, #3a2253 0%, #5b2a88 100%);
}
.support-card__badge { padding: 2px 8px; border-radius: 999px; background: var(--surface); font-size: 12px; line-height: 16px; }
.support-card__title { font-size: 14px; font-weight: 600; line-height: 20px; }
.support-card__text { color: var(--muted); font-size: 12px; line-height: 16px; }
.support-card .btn { margin-top: auto; }
.support-card__img { position: absolute; right: -10px; bottom: 0; width: 160px; height: 188px; object-fit: cover; object-position: left bottom; }

.footer__contacts dt { color: var(--muted); font-size: 12px; line-height: 16px; }
.footer__contacts dd { margin: 4px 0 16px; font-size: 14px; line-height: 20px; }

.footer__apps { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 292px; gap: 16px; }
.app-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    min-height: 152px;
    padding: 20px 16px 16px;
    overflow: hidden;
    border-radius: var(--r-m);
    background: linear-gradient(90deg, #a12cf0 0%, #7b1fd1 100%);
    color: #fff;
}
.app-card__title { position: relative; z-index: 1; font-size: 16px; font-weight: 600; line-height: 22px; }
.app-card__text { position: relative; z-index: 1; font-size: 12px; line-height: 16px; }
.app-card .btn { position: relative; z-index: 1; margin-top: auto; height: 36px; border-radius: var(--r-s); }
.app-card--mobile .btn { width: min(320px, 50%); }
.app-card__img { position: absolute; right: 0; bottom: 0; height: 100%; width: auto; max-width: 60%; object-fit: cover; object-position: right bottom; }
.app-card--ios { display: none; }

.footer__bottom {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 24px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    line-height: 16px;
}
.footer__age { font-family: var(--font-head); font-size: 22px; font-weight: 700; opacity: .7; }

/* ---------- узкие компьютеры ---------- */

@media (min-width: 1024px) and (max-width: 1279px) {
    .footer__card { grid-template-columns: 1fr 260px; }
    .footer__apps { grid-template-columns: 1fr 260px; }
}

/* ---------- телефон и планшет ---------- */

@media (max-width: 1023px) {
    :root { --pad: 16px; }

    .app-banner { display: flex; }

    .page { margin-left: 0; padding-bottom: 96px; }
    .is-collapsed .page { margin-left: 0; }

    .header { height: 72px; gap: 12px; }
    .logo__wide { display: none; }
    .logo__square { display: block; }
    .balance { gap: 8px; }
    .balance__deposit { width: 36px; padding: 0; }
    .balance__deposit span { display: none; }

    /* Боковое меню выезжает слева поверх страницы. */
    .sidebar {
        top: 8px;
        bottom: 104px;
        width: min(var(--side), calc(100vw - 48px));
        z-index: 60;
        transform: translateX(calc(-100% - 16px));
        transition: transform .3s ease;
    }
    .sidebar__toggle { display: none; }
    .menu-open .sidebar { transform: none; }
    .menu-overlay {
        position: fixed;
        inset: 0;
        z-index: 55;
        display: block;
        background: rgba(12, 5, 20, .6);
        opacity: 0;
        pointer-events: none;
        transition: opacity .3s;
    }
    .menu-open .menu-overlay { opacity: 1; pointer-events: auto; }

    .tabbar {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 70;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        align-items: end;
        padding: 0 8px calc(8px + env(safe-area-inset-bottom));
        background: linear-gradient(0deg, var(--bg) 60%, rgba(27, 14, 38, 0) 100%);
    }
    .tabbar::before {
        content: "";
        position: absolute;
        right: 8px;
        bottom: calc(8px + env(safe-area-inset-bottom));
        left: 8px;
        height: 70px;
        border-radius: var(--r-xl);
        background: var(--panel);
    }
    .tabbar__item {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
        height: 70px;
        padding-top: 12px;
        color: var(--muted);
        font-size: 10px;
        font-weight: 600;
        line-height: 14px;
        letter-spacing: .1px;
    }
    .tabbar__item.is-active { color: var(--accent); }
    .tabbar__icon { position: relative; display: grid; place-items: center; width: 28px; height: 28px; }
    .tabbar__icon .icon { width: 28px; height: 28px; }
    .tabbar__close { display: none; }
    .menu-open .tabbar__item:first-child { color: var(--accent); }
    .menu-open .tabbar__open { display: none; }
    .menu-open .tabbar__close { display: block; }
    .tabbar__badge {
        position: absolute;
        top: -4px;
        right: -8px;
        min-width: 18px;
        height: 18px;
        padding: 0 4px;
        border-radius: 999px;
        background: var(--lime);
        color: #000;
        font-size: 11px;
        font-style: normal;
        line-height: 18px;
        text-align: center;
    }
    .tabbar__item--deposit { padding-top: 0; }
    .tabbar__deposit {
        display: grid;
        place-items: center;
        width: 52px;
        height: 52px;
        margin-top: -14px;
        border-radius: 50%;
        background: var(--green);
        box-shadow: 0 0 0 6px var(--bg);
        color: #000;
    }
    .tabbar__deposit .icon { width: 26px; height: 26px; }

    .footer { padding-top: 32px; }
    .footer__card { grid-template-columns: 1fr; gap: 24px; padding: 24px 16px; }
    .footer__main { gap: 8px; }
    .footer__links { grid-template-columns: 1fr; gap: 8px; }
    .footer__title { margin: 0; padding: 8px 0; font-size: 18px; cursor: pointer; }
    .footer__col[open] .footer__title { margin-bottom: 12px; }
    .footer__chevron { display: block; }
    .footer__col[open] .footer__chevron { transform: rotate(180deg); }
    .footer__list--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .footer .logo__wide { display: none; }
    .footer .logo__square { display: block; }
    .socials--footer { order: 3; margin-top: 8px; }
    .footer__side { gap: 16px; }
    .support-card { padding-right: 140px; }
    .footer__apps { grid-row: 2; grid-template-columns: 1fr; }
    .app-card--mobile, .app-card--mac { display: none; }
    .app-card--ios { display: flex; min-height: 100px; padding: 16px; }
    .app-card--ios .btn { position: absolute; right: 16px; bottom: 16px; }
    .app-card--ios .app-card__img { max-width: 45%; }
}

@media (max-width: 380px) {
    .balance__value { max-width: 64px; overflow: hidden; text-overflow: ellipsis; }
    .app-banner__badge { display: none; }
}
