/* ═══════════════════════════════════════════════════════════════════
   Новая навигация (App\NavV2). Файл подключается только под флагом —
   пока его видят одни админы. Цвета и шрифты — сайтовые.
   ═══════════════════════════════════════════════════════════════════ */

.nav2-sr {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

/* ── Шапка: ряд пунктов ─────────────────────────────────────────── */
.header--redesign .nav2__list {
    display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
    gap: 4px; list-style: none; margin: 0; padding: 0;
}
.header--redesign .nav2__link {
    position: relative; display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 12px; border-radius: 9px; color: #d6d9e0; font-size: 15px;
    line-height: 1.2; text-decoration: none; white-space: nowrap;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.header--redesign .nav2__link i { font-size: 15px; line-height: 1; color: #8a8a92; transition: color .2s ease; }
.header--redesign .nav2__link:hover { background-color: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.header--redesign .nav2__link:hover i { color: #FFD400; }
.header--redesign .nav2__link:focus-visible { outline: 2px solid #FFD400; outline-offset: 2px; }
/* Текущий раздел — короткая полоска под пунктом, одинаковая для всех
   (раньше у «Квестов» текст белел и появлялось жёлтое кольцо) */
.header--redesign .nav2__link[aria-current="page"] { color: #fff; }
.header--redesign .nav2__link[aria-current="page"]::after {
    content: ""; position: absolute; left: 50%; bottom: -8px; width: 18px; height: 3px;
    border-radius: 2px; background: #ff9800; transform: translateX(-50%); pointer-events: none;
}

/* «Квесты» — главный акцент */
.header--redesign .nav2__link--quests {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: #1b1206; font-weight: 700; box-shadow: 0 4px 16px rgba(255, 152, 0, .22);
}
.header--redesign .nav2__link--quests i,
.header--redesign .nav2__link--quests:hover i { color: #1b1206; }
.header--redesign .nav2__link--quests:hover { background: linear-gradient(135deg, #ffab2e 0%, #ff8f1a 100%); color: #1b1206; }
.header--redesign .nav2__link--quests[aria-current="page"] { color: #1b1206; box-shadow: 0 4px 20px rgba(255, 152, 0, .4); }

/* «Играть» — второй акцент */
.header--redesign .nav2__link--play { color: #FFD400; border: 1px solid rgba(255, 212, 0, .38); padding: 8px 11px; }
.header--redesign .nav2__link--play i { color: #FFD400; }
.header--redesign .nav2__link--play:hover { background-color: rgba(255, 212, 0, .1); color: #ffe45c; }
.header--redesign .nav2__link--play .nav2__ext { font-size: 10px; opacity: .7; margin-left: -1px; }

/* Отметки */
.nav2__badge {
    /* У цифр нет выносных элементов, и при line-height: 1 текст садился
       выше центра — сверху отступ на пиксель больше */
    display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 2px; border-radius: 6px;
    font-size: 11.5px; font-weight: 700; line-height: 1; letter-spacing: .2px;
    font-variant-numeric: tabular-nums;
}
.nav2__badge--timer { color: #6ee0a0; background: rgba(76, 175, 80, .14); min-width: 48px; justify-content: center; }
/* Отступы плашки 4/2 опускают середину на 1px — кружок поднимаем обратно */
.nav2__badge--timer::before { content: ""; position: relative; top: -1px; width: 6px; height: 6px; border-radius: 50%; background: #3ddc84; flex: none; }
.nav2__badge--count { color: #fff; background: rgba(0, 0, 0, .28); min-width: 20px; justify-content: center; }

/* «Ещё» на компьютере: Марафон и справочные пункты */
.header--redesign .nav2__item--more { position: relative; }
.header--redesign .nav2__more-btn { border: 0; background: none; font-family: inherit; cursor: pointer; }
.header--redesign .nav2__chev { font-size: 10px; transition: transform .2s ease; }
.header--redesign .nav2__more-btn[aria-expanded="true"] { background-color: rgba(255, 255, 255, .06); color: #fff; }
.header--redesign .nav2__more-btn[aria-expanded="true"] .nav2__chev { transform: rotate(180deg); }
.header--redesign .nav2__more-btn.is-current { color: #fff; }
.header--redesign .nav2__more-btn.is-current::after {
    content: ""; position: absolute; left: 50%; bottom: -8px; width: 18px; height: 3px;
    border-radius: 2px; background: #ff9800; transform: translateX(-50%); pointer-events: none;
}
.nav2-dropdown {
    /* от левого края кнопки: «Ещё» больше не последний, справа от него «Играть» */
    position: absolute; top: calc(100% + 10px); left: 0; z-index: 60; min-width: 230px;
    display: grid; gap: 2px; padding: 6px;
    background: #1b1e25; border: 1px solid rgba(255, 255, 255, .08); border-radius: 12px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, .5);
}
.nav2-dropdown[hidden] { display: none !important; }
.nav2-dropdown__link {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
    color: #e0e3ea; font-size: 14px; line-height: 1.2; text-decoration: none; white-space: nowrap;
}
.nav2-dropdown__link i { width: 18px; text-align: center; color: #8a8a92; }
.nav2-dropdown__link:hover, .nav2-dropdown__link:focus-visible { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav2-dropdown__link[aria-current="page"] { color: #fff; background: rgba(255, 152, 0, .12); }
.nav2-dropdown__link[aria-current="page"] i { color: #ff9800; }

/* Компьютер. В старой шапке сетка «1fr auto 1fr»: боковые колонки равны,
   и широкий блок аккаунта (у админа — «Вывод», ник, баланс) сжимал меню
   до ~620px — «Играть» уезжал на вторую строку. Здесь меню получает всё,
   что осталось между логотипом и аккаунтом. */
@media (min-width: 1025px) {
    html.nav2-on .header--redesign { grid-template-columns: auto minmax(0, 1fr) auto; }
    html.nav2-on .header--redesign .nav2__list { flex-wrap: nowrap; }
    /* Меню — контейнер на всю свою колонку: ужимается по месту, которое есть
       на самом деле, а не по ширине окна. Раньше значки пропадали уже до
       1560px окна — при масштабе браузера 100% их не было, хотя место было. */
    html.nav2-on .header--redesign .header__nav.nav2 { justify-self: stretch; min-width: 0; container-type: inline-size; }
}
/* Ступени по ширине ряда (замер 12.09.2026, после переноса Марафона в «Ещё»):
   полный — 747px; 14px — 702; без значков — 634; компактно — 556.
   Стрелку у «Ещё» (.nav2__chev) не прячем вместе со значками. */
@container (max-width: 754px) {
    .header--redesign .nav2__link { padding: 9px 10px; font-size: 14px; }
}
@container (max-width: 709px) {
    .header--redesign .nav2__link:not(.nav2__link--quests):not(.nav2__link--play) > i:not(.nav2__chev) { display: none; }
}
@container (max-width: 641px) {
    .header--redesign .nav2__link { padding: 8px 7px; font-size: 13px; }
    .header--redesign .nav2__ext { display: none; }
}
/* Браузеры без контейнерных запросов — ступени по ширине окна (место = окно − 572) */
@supports not (container-type: inline-size) {
    @media (min-width: 1151px) and (max-width: 1330px) {
        .header--redesign .nav2__link { padding: 9px 10px; font-size: 14px; }
        .header--redesign .nav2__link:not(.nav2__link--quests):not(.nav2__link--play) > i:not(.nav2__chev) { display: none; }
    }
    @media (min-width: 1151px) and (max-width: 1215px) {
        .header--redesign .nav2__link { padding: 8px 7px; font-size: 13px; }
        .header--redesign .nav2__ext { display: none; }
    }
}
/* 1025–1150: меню — отдельной строкой под логотипом и аккаунтом, как на планшете */
@media (min-width: 1025px) and (max-width: 1150px) {
    html.nav2-on .header--redesign { grid-template-columns: auto 1fr; grid-template-areas: "logo user" "nav nav"; row-gap: 4px; }
    html.nav2-on .header--redesign .header__logo { grid-area: logo; }
    html.nav2-on .header--redesign .header__user { grid-area: user; }
    html.nav2-on .header--redesign .header__nav { grid-area: nav; }
}

/* Телефон: ряд скрыт, вместо него нижняя панель */
@media (max-width: 768px) {
    html.nav2-on .header--redesign .header__nav.nav2 { display: none !important; }
}

/* ── Меню аккаунта: баланс и «Вывести» ───────────────────────────── */
.nav2-balance { display: flex; align-items: center; gap: 8px; padding: 6px 12px 8px; }
.nav2-balance__label { font-size: 12px; color: #8a8f9c; }
.nav2-balance__sum { margin-right: auto; font-weight: 700; color: #FFD400; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nav2-balance__btn {
    font-size: 12px; font-weight: 700; padding: 6px 10px; border-radius: 8px; white-space: nowrap;
    color: #FFD400; background: rgba(255, 212, 0, .1); border: 1px solid rgba(255, 212, 0, .35); text-decoration: none;
}
.nav2-balance__btn:hover { background: rgba(255, 212, 0, .18); color: #ffe45c; text-decoration: none; }

/* ── Нижняя панель ───────────────────────────────────────────────── */
.nav2-tabbar, .nav2-more { display: none; }
.nav2-more[hidden] { display: none !important; }

@media (max-width: 768px) {
    html.nav2-on body { padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }

    .nav2-tabbar {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 9000;
        display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
        background: rgba(20, 21, 28, .96); border-top: 1px solid rgba(255, 255, 255, .08);
        -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    }
    .nav2-tabbar__item {
        position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
        gap: 3px; min-height: 50px; padding: 4px 2px; margin: 0; border: 0; background: none;
        color: #9aa0ac; font: inherit; font-size: 11px; font-weight: 600; line-height: 1.1;
        text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
    }
    .nav2-tabbar__item i { font-size: 19px; line-height: 1; }
    .nav2-tabbar__item:hover, .nav2-tabbar__item:focus-visible { color: #fff; text-decoration: none; }
    .nav2-tabbar__item:focus-visible { outline: 2px solid #FFD400; outline-offset: -2px; border-radius: 10px; }
    .nav2-tabbar__item[aria-current="page"] { color: #fff; }
    .nav2-tabbar__item[aria-current="page"] > i { color: #ff9800; }

    .nav2-tabbar__item--quests,
    .nav2-tabbar__item--quests[aria-current="page"] { color: #ffb74d; }
    .nav2-tabbar__item--quests[aria-current="page"] { font-weight: 800; }
    .nav2-tabbar__main {
        position: relative; display: flex; align-items: center; justify-content: center;
        width: 50px; height: 50px; margin-top: -24px; border-radius: 50%;
        background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%); color: #1b1206;
        box-shadow: 0 6px 18px rgba(255, 152, 0, .35), 0 0 0 4px rgba(20, 21, 28, .96);
    }
    .nav2-tabbar__main i { font-size: 21px; }
    .nav2-tabbar__count {
        position: absolute; top: -3px; right: -7px; min-width: 19px; height: 19px; padding: 0 5px;
        border-radius: 10px; background: #FFD400; color: #1b1206; font-size: 11px; font-weight: 800;
        line-height: 19px; text-align: center; font-variant-numeric: tabular-nums;
        box-shadow: 0 0 0 2px rgba(20, 21, 28, .96);
    }
    .nav2-tabbar__item--play { color: #FFD400; }
    .nav2-tabbar__timer {
        position: absolute; top: 0; left: 50%; transform: translateX(4px);
        padding: 1px 4px; border-radius: 5px; background: rgba(20, 21, 28, .96);
        color: #6ee0a0; font-size: 9.5px; font-weight: 700; font-variant-numeric: tabular-nums;
    }

    /* Кнопка чата — над панелью (в чате у неё bottom: 30px !important);
       под открытым листом «Ещё» прячем: её z-index выше и закрывал пункты */
    html.nav2-on .chat-toggle-btn { bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important; right: 16px !important; }
    html.nav2-more-open .chat-toggle-btn { display: none !important; }

    /* Виджет ВКонтакте — на уровень кнопки чата. В шаблоне он прижат
       правилом inset …12px 12px !important, и VK добавляет margin-bottom 20px;
       центр кнопки чата (54px) на 78px от низа, у виджета высота 50px. */
    html.nav2-on #vk_community_messages { inset: auto auto calc(60px + env(safe-area-inset-bottom, 0px)) 12px !important; }
    html.nav2-more-open #vk_community_messages { display: none !important; }

    /* Красная ссылка «/admin» в углу (только админам) закрывала «Ещё» */
    html.nav2-on a[href="/admin"][style*="position: fixed"] { bottom: calc(66px + env(safe-area-inset-bottom, 0px)) !important; }

    /* Лист «Ещё» */
    .nav2-more { display: block; position: fixed; inset: 0; z-index: 9500; }
    .nav2-more__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); }
    .nav2-more__sheet {
        position: absolute; left: 0; right: 0; bottom: 0; display: grid; gap: 2px;
        max-height: 80vh; overflow: auto; padding: 6px 12px calc(16px + env(safe-area-inset-bottom, 0px));
        background: #1b1e25; border-top: 1px solid rgba(255, 255, 255, .08); border-radius: 18px 18px 0 0;
        animation: nav2SheetUp .22s ease-out;
    }
    .nav2-more__head { display: flex; align-items: center; justify-content: space-between; padding: 8px 6px 10px; color: #fff; font-size: 16px; font-weight: 700; }
    .nav2-more__close {
        width: 38px; height: 38px; border: 0; border-radius: 10px; cursor: pointer;
        background: rgba(255, 255, 255, .06); color: #c9ced8; font-size: 24px; line-height: 1;
    }
    .nav2-more__link {
        display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 10px; border-radius: 10px;
        color: #e6e8ee; font-size: 15px; text-decoration: none;
    }
    .nav2-more__link i { width: 20px; text-align: center; color: #8a8a92; }
    .nav2-more__link:hover, .nav2-more__link:focus-visible { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
}
@keyframes nav2SheetUp { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }

/* ── Главная: заголовок «Кейсы» и строка категорий ────────────────── */
html.nav2-on { scroll-behavior: smooth; }
/* overflow: hidden у .page__main делал его контейнером прокрутки, и
   position: sticky у строки категорий не срабатывал. clip обрезает так же,
   но прилипанию не мешает. */
html.nav2-on .page__main { overflow: clip; }
.cases-head { margin: 4px 16px 6px; text-align: center; scroll-margin-top: 84px; }
/* Тот же Roboto 300, что у заголовков категорий (.title), — крупнее, но не жирнее */
.cases-head__title {
    margin: 0; color: #fff; font-family: inherit;
    font-size: 36px; line-height: 1.2; font-weight: 300; letter-spacing: .03em;
}
/* В покое без фона; полупрозрачная подложка — только когда строка прилипла
   (класс is-stuck ставит nav-v2.js), иначе поверх кейсов не прочитать */
.cases-chips {
    position: sticky; top: 0; z-index: 10;
    display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
    margin: 0 0 18px; padding: 10px 16px;
    background: transparent;
    transition: background-color .25s ease, box-shadow .25s ease, border-radius .25s ease;
}
.cases-chips.is-stuck {
    background: rgba(14, 15, 20, .62); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
    border-radius: 0 0 14px 14px;
}
/* На телефоне прилипшая строка во всю ширину экрана — углы прямые */
@media (max-width: 768px) {
    .cases-chips.is-stuck { border-radius: 0; }
}
.cases-chips::-webkit-scrollbar { display: none; }
.cases-chips__chip {
    flex: none; padding: 8px 14px; border-radius: 999px; white-space: nowrap;
    color: #c9ced8; font-size: 14px; line-height: 1.2; text-decoration: none;
    background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1);
    transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.cases-chips__chip:hover { color: #fff; border-color: rgba(255, 255, 255, .22); text-decoration: none; }
.cases-chips__chip:focus-visible { outline: 2px solid #FFD400; outline-offset: 2px; }
.cases-chips__chip.is-active { color: #fff; background: rgba(255, 152, 0, .16); border-color: #ff9800; }
.cases-cat-title { scroll-margin-top: 76px; }

/* Шапка на деле не липкая (её родитель .page__header ровно по её высоте),
   поэтому строка категорий прилипает к самому верху */
@media (min-width: 1025px) {
    .cases-chips { justify-content: safe center; }
}
@media (max-width: 600px) {
    .cases-head__title { font-size: 28px; }
    .cases-chips__chip { font-size: 13px; padding: 7px 12px; }
}

@media (prefers-reduced-motion: reduce) {
    html.nav2-on { scroll-behavior: auto; }
    .nav2-more__sheet { animation: none; }
}
