/* Шрифт подключён в variables.css (он первый на каждой странице),
   здесь только применяем токен. */
* {
    box-sizing: border-box;
    text-decoration: none;
}
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    color: var(--text-white);
    background-color: var(--ui-black);
    font-family: var(--font);
    font-weight: 400;
    font-style: normal;
}
body {
    display: flex;
    flex-direction: column;
    align-items: center;
}
a {
    color: var(--text-blue);
}
a:hover {
    opacity: 0.7;
}
.menu {
    width: 100%;
    height: var(--site-header-h);
    flex-shrink: 0;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    background: transparent;
    border-bottom: 1px solid var(--color-dark-grey);
    position: relative;
}

.menu-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-white);
    line-height: 1;
    transition: opacity 0.15s ease;
}

/* Знак логотипа: скруглённый квадрат на фирменном градиенте
   --gradient-brand (как заглушка аватара ниже). Та же марка — в
   static/img/favicon.svg. */
.menu-logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: var(--text-white);
    background: var(--gradient-brand);
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.5px;
}

.menu-logo-name {
    text-transform: uppercase;
}

.menu-logo:hover {
    opacity: 0.8;
}

/* Хвост «.io» — тем же фиолетовым, с которого начинается знак:
   один акцент на весь логотип. */
.menu-logo-dot {
    color: var(--color-xp);
}

/* Правая группа меню: тарифы + пользователь (или вход). Меню
   разложено space-between, и без общей обёртки ссылка на тарифы
   уехала бы в центр полосы. */
.menu-right {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    height: 100%;
}

.menu-pricing {
    font-size: 14px;
    color: var(--text-light-grey);
    white-space: nowrap;
    transition: color 0.15s ease;
}

.menu-pricing:hover {
    color: var(--text-magenta);
    opacity: 1;
}

.menu-auth {
    font-size: 14px;
    color: var(--text-blue);
}

.menu-user {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    height: 100%;
}

.menu-user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-white);
    line-height: 1;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.15s ease;
}

.menu-user-name:hover {
    color: var(--text-magenta);
    opacity: 1;
}

.menu-user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--ui-dark-grey);
    border: 1px solid var(--color-dark-grey);
    flex-shrink: 0;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.menu-user-avatar:hover {
    border-color: var(--text-magenta);
    transform: scale(1.05);
    opacity: 1;
}

.menu-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.menu-user-avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-white);
    background: var(--gradient-brand);
    text-transform: uppercase;
}

/* ===================== НАВИГАЦИЯ ПОРТАЛА =====================
   Разделы витрины слева от пользовательской группы. Пунктов мало
   и они короткие, поэтому бургер не нужен: на узком экране полоса
   просто ужимается (см. медиазапрос в конце файла). */

.menu-nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 18px;
    margin-right: auto;
    margin-left: 28px;
    min-width: 0;
    overflow: hidden;
}

.menu-nav-link {
    font-size: 14px;
    color: var(--text-light-grey);
    white-space: nowrap;
    transition: color 0.15s ease;
}

.menu-nav-link:hover {
    color: var(--text-white);
    opacity: 1;
}

.menu-nav-link.is-active {
    color: var(--text-white);
}

/* ===================== ПОДВАЛ =====================
   База — на всех страницах: тонкая полоса с мелким серым текстом.
   На витрине (.footer-portal) к ней добавляются колонки ссылок. */

.footer {
    width: 100%;
    margin-top: auto;
    padding: 24px 20px 32px;
    border-top: 1px solid var(--color-dark-grey);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.footer-columns {
    width: 100%;
    max-width: 1200px;
    display: grid;
    grid-template-columns: minmax(200px, 2fr) repeat(auto-fit, minmax(140px, 1fr));
    gap: 24px 32px;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-tagline {
    margin: 0;
    max-width: 280px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-grey);
}

.footer-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-column-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-white);
}

.footer-link {
    font-size: 13px;
    color: var(--text-light-grey);
    transition: color 0.15s ease;
}

.footer-link:hover {
    color: var(--text-magenta);
    opacity: 1;
}

.copyrights {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 16px;
}

.copyrights p {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-grey);
}

.footer-legal,
.footer-up {
    font-size: 12px;
    color: var(--text-light-grey);
}

.footer-up {
    margin-left: auto;
}

/* ===================== СОГЛАСИЕ НА COOKIE =====================
   Полоса внизу окна (footer.ejs, #cookie-bar), пока пользователь не
   нажал «Принять»; согласие — в localStorage, скрипт там же. Ниже
   окна чата поддержки (9999), выше всего остального. */

.cookie-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 12px 20px;
    background-color: var(--layer-2);
    border-top: 1px solid var(--color-dark-grey);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
}

.cookie-bar[hidden] {
    display: none;
}

.cookie-bar-text {
    margin: 0;
    max-width: 760px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-light-grey);
}

.cookie-bar-accept {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--site-control-h);
    padding: 0 18px;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-white);
    background-color: var(--color-purple);
    border: 1px solid var(--color-purple);
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.cookie-bar-accept:hover {
    opacity: 0.85;
}

/* ===================== ССЫЛКА НА ИГРУ =====================
   Партиал share_link.ejs: поле со ссылкой и кнопка копирования.
   Стоит в меню карточек витрины и в формочке «Поделиться» на
   странице игры — ширину поля задаёт место, куда его вставили. */

.share-link {
    display: flex;
    gap: 4px;
}

.share-link-input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 5px 8px;
    font: inherit;
    font-size: 12px;
    color: var(--text-light-grey);
    background-color: rgba(20, 24, 32, 0.7);
    border: 1px solid var(--color-dark-grey);
    border-radius: 6px;
    outline: none;
}

.share-link-input:focus {
    color: var(--text-white);
    border-color: var(--color-purple);
}

.share-link-copy {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 28px;
    padding: 0;
    color: var(--text-light-grey);
    background: transparent;
    border: 1px solid var(--color-dark-grey);
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.share-link-copy:hover,
.share-link-copy.is-copied {
    color: var(--text-white);
    border-color: var(--color-purple);
}

.share-link-icon {
    width: 14px;
    height: 14px;
}

.share-link-icon-done,
.share-link-copy.is-copied .share-link-icon-copy {
    display: none;
}

.share-link-copy.is-copied .share-link-icon-done {
    display: block;
}

/* ===================== УЗКИЙ ЭКРАН ===================== */

@media (max-width: 640px) {
    .menu {
        padding: 0 12px;
        gap: 10px;
    }

    .menu-nav {
        margin-left: 14px;
        gap: 12px;
    }

    .menu-nav-link,
    .menu-pricing,
    .menu-auth {
        font-size: 13px;
    }

    /* Имя рядом с аватаром — первое, чем можно пожертвовать: аватар
       и так ведёт в профиль и остаётся кликабельным. */
    .menu-user-name {
        display: none;
    }

    .footer {
        padding: 20px 16px 28px;
        gap: 20px;
    }

    .footer-columns {
        grid-template-columns: 1fr 1fr;
    }

    .footer-brand {
        grid-column: 1 / -1;
    }

    .footer-up {
        margin-left: 0;
    }

    .cookie-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 16px;
    }
}

/* ===================== РАЗВОРОТ НА ВЕСЬ ЭКРАН =====================
   Кнопка с уголками поверх сцены: игра (js/game/player.js) и граф
   ассета (js/assets/page.js). Не системный fullscreen — страница
   сама растягивает сцену классом is-maximized, а место кнопки в углу
   задаёт страница. */

/* Пока сцена развёрнута — страница под ней не прокручивается. */
body.stage-maximized {
    overflow: hidden;
}

/* display из класса перебивает [hidden] браузера — без этого правила
   кнопка висела над постером ещё до запуска игры. */
.stage-expand[hidden] {
    display: none;
}

.stage-expand {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: rgba(20, 24, 32, 0.55);
    border: 1px solid var(--color-dark-grey);
    border-radius: 8px;
    color: var(--text-white);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.stage-expand:hover {
    opacity: 1;
    background: rgba(144, 19, 254, 0.45);
    border-color: var(--color-purple);
}

/* Иконка «развернуть»: две уголковые скобки, растянутые по диагонали.
   В режиме is-on они сдвигаются внутрь — читается как «свернуть». */
.stage-expand-icon {
    position: relative;
    width: 16px;
    height: 16px;
}

.stage-expand-icon::before,
.stage-expand-icon::after {
    content: "";
    position: absolute;
    width: 7px;
    height: 7px;
    border-color: currentColor;
    border-style: solid;
}

.stage-expand-icon::before {
    top: 0;
    left: 0;
    border-width: 2px 0 0 2px;
}

.stage-expand-icon::after {
    bottom: 0;
    right: 0;
    border-width: 0 2px 2px 0;
}

.stage-expand.is-on .stage-expand-icon::before {
    top: 2px;
    left: 2px;
}

.stage-expand.is-on .stage-expand-icon::after {
    bottom: 2px;
    right: 2px;
}
