/* Общая шапка сайта — одна для главной и всех разделов.
   Свои переменные и классы gh-*: страницы живут на разных таблицах стилей
   (landing.css, party.css, app.css), и шапка не должна от них зависеть. */

.gh {
    --gh-ink: #f6eee2; --gh-muted: #bbaf9d; --gh-faint: #8a8071;
    --gh-line: rgba(255, 243, 224, .10); --gh-accent: #eb5c21; --gh-accent-2: #ffa047;
    position: sticky; top: 0; z-index: 90;
    font-family: 'Golos Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--gh-ink);
    background: rgba(10, 9, 8, .82);
    backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
    border-bottom: 1px solid var(--gh-line);
}
/* Главная: шапка поверх первого экрана, фон появляется при прокрутке (landing.js ставит is-stuck). */
.gh.gh--float { position: fixed; left: 0; right: 0; top: 0; padding: 0; background: transparent; border-bottom-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; transition: background .3s, border-color .3s; }
.gh.gh--float.is-stuck, .gh.gh--float.is-menu { padding: 0; background: rgba(8, 7, 6, .9); border-bottom-color: var(--gh-line); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); }

.gh__in {
    max-width: 1760px; margin: 0 auto; min-height: 70px;
    padding: 10px clamp(14px, 2.2vw, 32px);
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px;
}

/* ── Логотип ── */
.gh-logo { display: inline-flex; align-items: center; gap: 12px; min-width: 0; color: inherit; text-decoration: none; }
.gh-logo:hover { text-decoration: none; }
.gh-logo__img { display: block; height: 46px; width: auto; max-width: 220px; object-fit: contain; }
.gh-logo--lockup .gh-logo__img { height: 54px; max-width: 290px; }
.gh-logo__mark { width: 40px; height: 40px; flex: none; }
.gh-logo__text { display: grid; line-height: 1.15; min-width: 0; }
.gh-logo__text b { font-size: 17px; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; }
.gh-logo__text small { margin-top: 3px; font-size: 10px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; color: var(--gh-faint); white-space: nowrap; }

/* ── Разделы ── */
.gh-nav { display: flex; justify-content: safe center; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.gh-nav::-webkit-scrollbar { display: none; }
.gh-nav a {
    display: inline-flex; align-items: center; gap: 7px; height: 42px; padding: 0 14px;
    border-radius: 12px; color: var(--gh-muted); font-size: 15px; font-weight: 700; white-space: nowrap;
    text-decoration: none; transition: color .2s, background .2s, box-shadow .2s;
}
.gh-nav a i { font-style: normal; font-size: 12px; color: var(--gh-accent-2); opacity: .55; }
.gh-nav a:hover { color: var(--gh-ink); background: rgba(255, 255, 255, .06); text-decoration: none; }
.gh-nav a[aria-current="page"] {
    color: var(--gh-ink);
    background: linear-gradient(180deg, rgba(255, 160, 71, .2), rgba(235, 92, 33, .1));
    box-shadow: inset 0 0 0 1px rgba(255, 160, 71, .3);
}
.gh-nav a[aria-current="page"] i { opacity: 1; }

/* Разделы не влезли в строку (скрипт шапки ставит gh--stack) — второй строкой, по центру. */
.gh--stack .gh__in { grid-template-columns: auto 1fr; row-gap: 4px; }
.gh--stack .gh-nav { grid-column: 1 / -1; order: 3; overflow: visible; flex-wrap: wrap; justify-content: center; padding-bottom: 2px; }
.gh--stack .gh-nav a { height: 38px; }

/* ── Кошелёк: одна плашка на четыре счёта ── */
.gh-side { display: flex; align-items: center; gap: 8px; justify-self: end; }
.gh-wallet { display: inline-flex; align-items: stretch; height: 38px; border-radius: 999px; border: 1px solid var(--gh-line); background: rgba(255, 255, 255, .04); overflow: hidden; }
.gh-w { display: inline-flex; align-items: center; gap: 6px; padding: 0 11px; color: var(--gh-ink); font-size: 14px; white-space: nowrap; text-decoration: none; transition: background .2s; }
.gh-w + .gh-w { border-left: 1px solid var(--gh-line); }
.gh-w:hover { background: rgba(255, 255, 255, .08); text-decoration: none; }
.gh-w img { width: 17px; height: 17px; object-fit: contain; }
.gh-w b { font-weight: 800; }
.gh-w small { color: var(--gh-faint); font-size: 12px; font-weight: 600; }
.gh-w--ai i { font-style: normal; color: #c9b6ff; }
.gh-w--gem b { color: #a9d8ff; }

.gh-user { display: inline-flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; }
.gh-user:hover { text-decoration: none; }
.gh-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; font-weight: 800; color: #fff; background: linear-gradient(145deg, #db7e38, #7f3820); }
.gh-user__name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--gh-muted); }
.gh-user:hover .gh-user__name, .gh-user[aria-current] .gh-user__name { color: var(--gh-ink); }

.gh-btn {
    display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 18px;
    border: 0; border-radius: 12px; cursor: pointer; text-decoration: none; white-space: nowrap;
    font: inherit; font-size: 15px; font-weight: 800; color: #1a0d05;
    background: linear-gradient(180deg, var(--gh-accent-2), var(--gh-accent));
    box-shadow: 0 8px 24px rgba(235, 92, 33, .28);
}
.gh-btn:hover { filter: brightness(1.07); text-decoration: none; }
.gh-btn--ghost { color: var(--gh-ink); background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px var(--gh-line); }

/* ── Меню на телефоне ── */
.gh-burger { display: none; width: 42px; height: 42px; padding: 0; border: 1px solid var(--gh-line); border-radius: 12px; background: rgba(255, 255, 255, .05); cursor: pointer; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.gh-burger span { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--gh-ink); transition: transform .2s, opacity .2s; }
.gh-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.gh-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.gh-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.gh-menu { border-top: 1px solid var(--gh-line); padding: 12px clamp(14px, 4vw, 24px) 16px; background: rgba(10, 9, 8, .96); max-height: calc(100svh - 64px); overflow-y: auto; }
.gh-menu nav { display: grid; gap: 6px; }
.gh-menu nav a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; color: var(--gh-ink); text-decoration: none; background: rgba(255, 255, 255, .04); border: 1px solid var(--gh-line); }
.gh-menu nav a[aria-current="page"] { border-color: rgba(255, 160, 71, .4); background: rgba(255, 160, 71, .1); }
.gh-menu nav i { width: 28px; font-style: normal; font-size: 17px; text-align: center; color: var(--gh-accent-2); }
.gh-menu nav b { display: block; font-size: 16px; }
.gh-menu nav small { display: block; font-size: 12.5px; color: var(--gh-faint); }
.gh-menu__foot { display: flex; gap: 8px; margin-top: 12px; }
.gh-menu__foot .gh-btn { flex: 1; height: 46px; }

/* ── Ширины ──
   Значки разделов — только в меню телефона; подпись под логотипом и имя у
   аватарки — только на очень широких экранах. Так на обычном 1920 все
   разделы, кошелёк и «Играть» помещаются в одну строку. */
.gh-nav a i { display: none; }
.gh-logo__text small, .gh-user__name { display: none; }
@media (min-width: 2100px) { .gh-nav a i { display: inline; } .gh-logo__text small { display: block; } .gh-user__name { display: inline; } }
@media (max-width: 1440px) { .gh-nav a { padding: 0 11px; font-size: 14px; } .gh-w--ai small { display: none; } }

@media (max-width: 760px) {
    .gh__in { min-height: 60px; padding: 8px 12px; gap: 8px; grid-template-columns: auto 1fr; }
    .gh-nav, .gh-user, .gh-play, .gh-login { display: none !important; }
    .gh-burger { display: inline-flex; }
    .gh-logo__text { display: none; }
    .gh-logo__img { height: 38px; }
    .gh-logo__mark { width: 34px; height: 34px; }
    .gh-wallet { height: 36px; }
    .gh-w { padding: 0 8px; font-size: 13px; gap: 4px; }
    .gh-w small, .gh-w--ai { display: none; }
    .gh-side { gap: 6px; }
}
@media (max-width: 360px) { .gh-w img { display: none; } }

/* ── Телефоны: без «пружины» и фиксированного фона ──
   background-attachment: fixed и отскок у края страницы на iPhone дают
   дрожание у нижней границы сайта: фон перерисовывается на каждом кадре. */
@media (hover: none) {
    html { overscroll-behavior-y: none; }
    body, body.party-page { background-attachment: scroll !important; }
}

/* ── Прокрутка страниц — одна на весь сайт, в цвет углей ── */
@media (hover: hover) {
    html { scrollbar-width: thin; scrollbar-color: rgba(235, 92, 33, .6) rgba(255, 243, 224, .04); }
    ::-webkit-scrollbar { width: 11px; height: 11px; }
    ::-webkit-scrollbar-track { background: rgba(255, 243, 224, .03); }
    ::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #ffa047, #eb5c21); border-radius: 10px; border: 3px solid #0a0908; }
    ::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #ffc070, #ffa047); }
}

/* Знак «в профиле есть что забрать»: награда за вход, готовое задание, Фортуна. */
.gh-user { position: relative; }
.gh-user__alert {
    position: absolute; top: -5px; left: -5px; z-index: 2;
    display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
    background: #f47735; color: #140d06; font: 700 12px/1 'Golos Text', system-ui, sans-serif;
    font-style: normal; box-shadow: 0 0 0 0 rgba(244, 119, 53, .6); animation: ghAlert 2.4s ease-out infinite;
}
@keyframes ghAlert {
    0%   { box-shadow: 0 0 0 0 rgba(244, 119, 53, .55); }
    70%  { box-shadow: 0 0 0 9px rgba(244, 119, 53, 0); }
    100% { box-shadow: 0 0 0 0 rgba(244, 119, 53, 0); }
}
@media (prefers-reduced-motion: reduce) { .gh-user__alert { animation: none; } }


/* Кнопка «Играть» в шапке — в одном тоне с кнопками страниц. */
.gh-btn {
    border-radius: 14px; height: 42px; padding: 0 20px;
    background: linear-gradient(180deg, #ff9f4c 0%, #f2711f 52%, #d9590f 100%);
    box-shadow: 0 10px 24px -10px rgba(217, 89, 15, .8), inset 0 1px 0 rgba(255, 255, 255, .3);
    transition: transform .2s ease, box-shadow .25s ease;
}
.gh-btn:hover { filter: none; transform: translateY(-2px); box-shadow: 0 16px 32px -12px rgba(217, 89, 15, .95); }
.gh-btn--ghost {
    background: rgba(255, 255, 255, .05); box-shadow: inset 0 0 0 1px var(--gh-line);
}
.gh-btn--ghost:hover { background: rgba(255, 176, 93, .1); box-shadow: inset 0 0 0 1px rgba(255, 176, 93, .45); }


/* Кнопка шапки — то же светлое золото, что и на страницах. */
.gh-btn {
    color: #221603;
    background: linear-gradient(180deg, rgba(255, 229, 176, .96), rgba(250, 205, 130, .92));
    box-shadow: 0 10px 24px -14px rgba(255, 206, 128, .85), inset 0 1px 0 rgba(255, 255, 255, .55);
}
.gh-btn:hover {
    background: linear-gradient(180deg, rgba(255, 238, 199, 1), rgba(255, 215, 146, .96));
    box-shadow: 0 14px 30px -14px rgba(255, 206, 128, .95);
}


/* Кнопка шапки — такая же тихая плитка, как кнопки страниц. */
.gh-btn, .gh-btn:hover {
    color: #ffdca6; font-weight: 600;
    background: linear-gradient(160deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1);
}
.gh-btn:hover {
    color: #fff0cf; background: linear-gradient(160deg, rgba(255, 220, 166, .18), rgba(255, 220, 166, .05));
    box-shadow: inset 0 0 0 1px rgba(255, 220, 166, .42);
}

/* ── iPhone, ярлык «на экран Домой» ───────────────────────────────────────
   Строка статуса телефона лежит поверх страницы (status-bar-style
   black-translucent + viewport-fit=cover), и шапка уезжала под часы и батарею.
   Отступ сверху равен высоте этой строки; на компьютере он равен нулю. */
.gh__in { padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
.gh-menu { padding-top: calc(12px + env(safe-area-inset-top, 0px)); }

/* Под шапкой тоже добавляем: на страницах с плавающей шапкой первый экран
   начинается прямо под строкой статуса. */
.gh.gh--float ~ .hero, .gh.gh--float + main { padding-top: env(safe-area-inset-top, 0px); }


/* ══ Шапка не должна распирать страницу ══════════════════════════════════
   Кошелёк пишется в одну строку (nowrap), и у колонок сетки минимальная
   ширина по содержимому. У вошедшего человека на телефоне это давало шапку
   шире экрана: страница уезжала вбок целиком — вместе с первым экраном и
   модальными окнами, потому что они тоже position: fixed.

   Лечим в три слоя: колонкам разрешаем сжиматься, кошельку — обрезаться,
   а на узких экранах монеты и билеты уходят (они и так в «Заданиях»),
   остаются алмазы — единственная плашка, за которой идут в магазин. */
.gh { max-width: 100%; }
.gh__in { min-width: 0; }
.gh__in > * { min-width: 0; }
.gh-side { min-width: 0; }
.gh-wallet { min-width: 0; overflow: hidden; }
.gh-w { flex: 0 1 auto; min-width: 0; }
.gh-w b { overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 760px) {
    .gh__in { grid-template-columns: auto minmax(0, 1fr); }
    /* Логотип-картинка может быть какой угодно ширины: на телефоне ограничиваем
       её долей экрана, иначе она одна съедает место под кошелёк и бургер. */
    .gh-logo__img { max-width: 38vw; }
}
@media (max-width: 480px) {
    .gh-w--coins, .gh-w--pass { display: none; }
}


/* ══ «Добавьте на экран „Домой“» ═════════════════════════════════════════
   Панель внизу экрана, только на айфоне и только один раз. Держится над
   кнопкой помощи, уважает вырез снизу и закрывается крестиком. */
.ios-add {
    position: fixed; left: 12px; right: 12px; z-index: 80;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    padding: 18px 44px 16px 18px;
    border-radius: 18px;
    border: 1px solid rgba(255, 215, 150, .22);
    background: linear-gradient(180deg, rgba(32, 24, 16, .97), rgba(18, 14, 10, .98));
    box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    color: #f6eee2;
    opacity: 0; transform: translateY(18px);
    transition: opacity .26s ease, transform .26s cubic-bezier(.22, .61, .36, 1);
}
.ios-add.is-on { opacity: 1; transform: none; }
.ios-add > b { display: block; font-size: 15px; line-height: 1.35; }
.ios-add p { margin: 7px 0 0; font-size: 12.5px; line-height: 1.6; color: #c9bda9; }
.ios-add__how { color: #e4d6bd !important; }
.ios-add__how b { color: #ffdca6; font-weight: 700; }
.ios-add__share {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; vertical-align: -7px; margin: 0 1px;
    border-radius: 7px; border: 1px solid rgba(255, 255, 255, .16);
    background: rgba(255, 255, 255, .07); color: #8ec6ff;
}
.ios-add__row { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.ios-add__go {
    flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center;
    min-height: 42px; padding: 0 16px; border-radius: 12px;
    font-size: 13px; font-weight: 600; color: #ffdca6; text-decoration: none;
    border: 1px solid rgba(255, 255, 255, .12);
    background: linear-gradient(160deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02));
}
.ios-add__later {
    flex: none; min-height: 42px; padding: 0 14px; border: 0; border-radius: 12px;
    background: none; color: #9d9282; font: inherit; font-size: 13px; cursor: pointer;
}
.ios-add__x {
    position: absolute; top: 8px; right: 8px; width: 32px; height: 32px;
    border: 0; border-radius: 10px; background: none; color: #9d9282;
    font-size: 22px; line-height: 1; cursor: pointer;
}
.ios-add__x:hover, .ios-add__later:hover { color: #f6eee2; }
@media (prefers-reduced-motion: reduce) {
    .ios-add { transition: none; }
}


/* ══ Меню разделов на телефоне ═══════════════════════════════════════════
   Раньше это был ровный список одинаковых серых строк, и раздел без значка
   (MMORPG) выглядел в нём случайной опечаткой. Теперь у каждого пункта свой
   цвет и своя нарисованная картинка справа — те же, что на карточках сайта. */
.gh-menu__item { position: relative; overflow: hidden; isolation: isolate; }
.gh-menu__art {
    position: absolute; inset: 0 0 0 auto; z-index: -1;
    width: 62%; height: 100%; object-fit: cover; object-position: center;
    opacity: .5;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 68%);
            mask-image: linear-gradient(90deg, transparent, #000 68%);
}
.gh-menu nav .gh-menu__item {
    border-color: color-mix(in srgb, var(--tint, #ffd79a) 26%, transparent);
    background:
        linear-gradient(90deg, rgba(10, 9, 8, .97) 42%, rgba(10, 9, 8, .62)),
        linear-gradient(120deg, color-mix(in srgb, var(--tint, #ffd79a) 13%, transparent), rgba(255, 255, 255, .03));
}
.gh-menu nav .gh-menu__item i { color: var(--tint, #ffd79a); }
.gh-menu nav .gh-menu__item b { color: var(--gh-ink); }
.gh-menu nav .gh-menu__item[aria-current="page"] {
    border-color: color-mix(in srgb, var(--tint, #ffd79a) 62%, transparent);
    box-shadow: inset 3px 0 0 var(--tint, #ffd79a);
}
/* Браузеры без color-mix получают прежний спокойный вид, а не пустоту. */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
    .gh-menu nav .gh-menu__item { border-color: var(--gh-line); background: rgba(255, 255, 255, .04); }
}

/* ══ Шапка на телефоне: название сайта ═══════════════════════════════════
   Когда монеты и билеты ушли с узких экранов, шапка стала пустой: значок,
   алмазы и бургер. Название возвращаем — по нему видно, где ты находишься. */
@media (max-width: 760px) {
    /* Колонка логотипа тоже должна уметь сжиматься: иначе длинное название
       снова распёрло бы шапку шире экрана — ровно та беда, что мы чинили. */
    .gh__in { grid-template-columns: minmax(0, auto) minmax(0, 1fr); }
    .gh-logo__text { display: grid; }
    .gh-logo__text b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
    .gh-logo__text small { display: none; }
    .gh-logo { gap: 9px; }
    .gh-logo__img { height: 32px; max-width: 26vw; }
}
@media (max-width: 380px) {
    .gh-logo__text b { font-size: 14px; }
}
