/* =====================================================================
   AOSE — компоненты (брендбук v2). Значения только из tokens.css.
   Мобильная версия по умолчанию, шире — через min-width.
   ===================================================================== */

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--c-bg);
    color: var(--c-text);
    font: 400 var(--fs-md)/var(--lh-text) var(--f-text);
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

/* Якоря не прячутся под липкую шапку */
[id] { scroll-margin-top: 88px; }

h1, h2, h3 {
    font-family: var(--f-display);
    font-weight: 600;
    line-height: var(--lh-tight);
    letter-spacing: -0.01em;
    margin: 0 0 var(--s-4);
    text-wrap: balance;
}
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); font-family: var(--f-text); font-weight: 600; letter-spacing: 0; }
@media (min-width: 1024px) { h1 { font-size: var(--fs-4xl); } }

p { margin: 0 0 var(--s-4); max-width: 68ch; }
.lead { font-size: var(--fs-lg); color: var(--c-text-muted); }
.muted { color: var(--c-text-muted); }

a { color: var(--c-accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--c-accent-hover); }

:focus-visible {
    outline: 2px solid var(--c-focus);
    outline-offset: 3px;
}

.container {
    width: 100%;
    max-width: calc(var(--w-page) + 2 * var(--gutter));
    margin: 0 auto;
    padding: 0 var(--gutter);
}

/* ---------- Шапка ---------- */
.site-header {
    position: sticky; top: 0; z-index: 20;
    background: var(--c-header-bg);
    border-bottom: 1px solid var(--c-line);
}
.site-header__row {
    display: flex; align-items: center; gap: var(--s-5);
    min-height: 64px;
}
/* Логотип: эмблема (вариант 20) + надпись */
.brand-logo { display: inline-flex; align-items: center; gap: var(--s-3); color: var(--c-text); text-decoration: none; }
.brand-logo .emblem { width: 44px; height: 44px; flex: none; }
/* В шапке — только эмблема, полный логотип с надписью — в подвале */
.site-header__logo .emblem { width: 48px; height: 48px; }
.brand-logo__word { display: grid; line-height: 1; }
.brand-logo__word b { font: 600 1.125rem/1 var(--f-display); letter-spacing: 0.06em; }
.brand-logo__word small { margin-top: 4px; font-size: 0.6875rem; letter-spacing: 0.04em; color: var(--c-accent); }
@media (max-width: 400px) { .brand-logo__word small { display: none; } .brand-logo__word b { font-size: 1rem; } }
.emblem__ring { fill: none; stroke: var(--c-accent-2); stroke-width: 3; }
.emblem__a { fill: var(--c-accent); stroke: var(--c-bg); stroke-width: 5; stroke-linejoin: round; paint-order: stroke; }
.emblem__gem { fill: var(--c-accent-2); }
.site-nav { display: none; gap: var(--s-5); }
.site-nav a {
    color: var(--c-text-muted); text-decoration: none; font-weight: 500; font-size: var(--fs-sm);
    padding: var(--s-2) 0; border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--c-text); }
.site-nav a[aria-current="page"] { color: var(--c-text); border-bottom-color: var(--c-accent); }
.site-header__end { margin-left: auto; display: flex; align-items: center; gap: var(--s-4); }
/* На телефоне статус сервера не помещается рядом с логотипом и «Войти» */
.site-header__end .status { display: none; }
@media (min-width: 640px) { .site-header__end .status { display: inline-flex; } }
@media (min-width: 1024px) { .site-nav { display: flex; } }

/* ---------- Статус сервера ---------- */
.status {
    display: inline-flex; align-items: center; gap: var(--s-2);
    font-size: var(--fs-sm); color: var(--c-text-muted); white-space: nowrap;
}
.status__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-success); }
.status--off .status__dot { background: var(--c-danger); }
.status b { color: var(--c-text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Кнопки ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
    min-height: 44px; padding: 0 var(--s-5);
    font: 600 var(--fs-sm)/1 var(--f-text);
    text-decoration: none; cursor: pointer;
    border: 1px solid var(--c-line-strong); border-radius: var(--r-1);
    background: transparent; color: var(--c-text);
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.btn:hover { background: var(--c-surface-2); color: var(--c-text); }
.btn:active { background: var(--c-surface); }

/* Главная кнопка: латунь и срезанные углы. На экране одна-две, не больше. */
.btn--primary {
    border: 0; border-radius: var(--r-btn);
    background: var(--c-accent); color: var(--c-on-accent);
    clip-path: var(--shape-btn);
}
.btn--primary:hover { background: var(--c-accent-hover); color: var(--c-on-accent); }
.btn--primary:active { background: var(--c-accent-press); }
/* clip-path срезает outline, поэтому фокус у главной кнопки — внутренней линией */
.btn--primary:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--c-on-accent); background: var(--c-accent-hover); }

.btn--text { border-color: transparent; padding: 0 var(--s-2); color: var(--c-accent); }
.btn--text:hover { background: transparent; color: var(--c-accent-hover); text-decoration: underline; }

.btn--lg { min-height: 52px; padding: 0 var(--s-6); font-size: var(--fs-md); }

.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.btn[aria-busy="true"] { pointer-events: none; }
.btn[aria-busy="true"]::before {
    /* Маленький «прилив» по силуэту знака вместо крутилки */
    content: ""; flex: none; width: 16px; height: 16px;
    background: linear-gradient(to top, currentColor 50%, rgb(128 128 128 / 0.35) 50%) 0 0 / 100% 200%;
    -webkit-mask: url("logo/aose-mask.svg") center / contain no-repeat;
            mask: url("logo/aose-mask.svg") center / contain no-repeat;
    animation: btn-tide 1.2s ease-in-out infinite alternate;
}
@keyframes btn-tide { to { background-position: 0 100%; } }
@media (prefers-reduced-motion: reduce) { .btn[aria-busy="true"]::before { animation: none; background: currentColor; } }

.icon { width: 18px; height: 18px; flex: none; }

/* ---------- Медиа в рамке со срезом (главный скрин, арт патча) ---------- */
.media-cut {
    position: relative; margin: 0;
    clip-path: var(--shape-media);
    border-radius: var(--r-media); overflow: hidden;
    background: var(--c-surface);
}
.media-cut img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }

/* ---------- Метки изменений (несут смысл: тип правки) ---------- */
.mark {
    display: inline-block; padding: 2px var(--s-2);
    font-size: var(--fs-xs); font-weight: 600; line-height: 1.5;
    border-radius: var(--r-1); border: 1px solid currentColor;
}
.mark--new     { color: var(--c-accent); }
.mark--changed { color: var(--c-accent-2); }
.mark--removed { color: var(--c-text-faint); }

/* ---------- Список новостей ---------- */
.news-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--c-line); }
.news-item {
    display: grid; grid-template-columns: 96px 1fr; gap: var(--s-4);
    padding: var(--s-4) 0; border-bottom: 1px solid var(--c-line);
}
.news-item img { width: 96px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-2); }
.news-item time { font-size: var(--fs-xs); color: var(--c-text-faint); }
.news-item h3 { font-size: var(--fs-md); margin: var(--s-1) 0; }
.news-item h3 a { color: var(--c-text); text-decoration: none; }
.news-item h3 a:hover { color: var(--c-accent-hover); }
.news-item p { font-size: var(--fs-sm); color: var(--c-text-muted); margin: 0; }
@media (min-width: 768px) {
    .news-item { grid-template-columns: 160px 1fr; gap: var(--s-5); }
    .news-item img { width: 160px; }
}

/* ---------- Таблица рейтинга ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--c-line); border-radius: var(--r-2); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); min-width: 520px; }
.table th {
    text-align: left; font-weight: 500; color: var(--c-text-faint);
    padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--c-line);
}
.table td { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--c-line); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--c-surface); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .rank { width: 56px; font-variant-numeric: tabular-nums; color: var(--c-text-muted); }
.table .rank--top { color: var(--c-accent); font-weight: 700; }
.table .me td { background: var(--c-accent-soft); }

/* ---------- Пустое состояние ---------- */
.empty {
    padding: var(--s-7) var(--s-5); text-align: center;
    border: 1px dashed var(--c-line-strong); border-radius: var(--r-2);
}
.empty h3 { margin-bottom: var(--s-2); }
.empty p { margin: 0 auto var(--s-4); color: var(--c-text-muted); }

/* ---------- Формы ---------- */
.field { display: grid; gap: var(--s-2); margin-bottom: var(--s-5); }
.field label { font-size: var(--fs-sm); font-weight: 500; }
.field input {
    min-height: 44px; padding: 0 var(--s-3);
    font: 400 var(--fs-md) var(--f-text); color: var(--c-text);
    background: var(--c-surface); border: 1px solid var(--c-line-strong); border-radius: var(--r-1);
    transition: border-color var(--t-fast);
}
.field input:hover { border-color: var(--c-text-faint); }
.field input:focus { outline: none; border-color: var(--c-accent); box-shadow: 0 0 0 1px var(--c-accent); }
.field__hint { font-size: var(--fs-xs); color: var(--c-text-faint); }
.field--error input { border-color: var(--c-danger); }
.field--error .field__hint { color: var(--c-danger); }

/* ---------- Уведомления ---------- */
.notice {
    display: flex; gap: var(--s-3); align-items: flex-start;
    padding: var(--s-3) var(--s-4); border-left: 3px solid; border-radius: var(--r-1);
    font-size: var(--fs-sm);
}
.notice p { margin: 0; }
.notice--error   { border-color: var(--c-danger);  background: var(--c-danger-bg); }
.notice--success { border-color: var(--c-success); background: var(--c-success-bg); }
.notice--info    { border-color: var(--c-accent-2);  background: var(--c-surface); }

/* ---------- Загрузка (скелет) ---------- */
.skeleton {
    border-radius: var(--r-1);
    background: linear-gradient(90deg, var(--c-surface) 0%, var(--c-surface-2) 50%, var(--c-surface) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* ---------- Патчноут: оглавление и записи ---------- */
.toc { font-size: var(--fs-sm); }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--c-line); }
.toc a {
    display: block; padding: var(--s-1) var(--s-4); margin-left: -1px;
    color: var(--c-text-muted); text-decoration: none; border-left: 2px solid transparent;
}
.toc a:hover { color: var(--c-text); }
.toc a[aria-current="true"] { color: var(--c-text); border-left-color: var(--c-accent); }

.change { padding: var(--s-4) 0; border-top: 1px solid var(--c-line); }
.change__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-2) var(--s-3); margin-bottom: var(--s-2); }
.change__head h3 { margin: 0; font-size: var(--fs-md); }
.change p { font-size: var(--fs-sm); color: var(--c-text-muted); margin: 0; }

.shot { margin: var(--s-5) 0; }
.shot img { border-radius: var(--r-2); cursor: zoom-in; }
.shot figcaption { margin-top: var(--s-2); font-size: var(--fs-xs); color: var(--c-text-faint); }

/* ---------- Логотип ---------- */
.logo { display: inline-flex; align-items: center; gap: var(--s-2); color: var(--c-text); text-decoration: none; }
.logo svg { width: 32px; height: 32px; flex: none; }
.logo__word { font: 700 1.125rem/1 var(--f-display); letter-spacing: 0.06em; text-transform: uppercase; }
.logo__word small { display: block; margin-top: 3px; font: 500 0.625rem/1 var(--f-text); letter-spacing: 0.18em; color: var(--c-text-muted); }
.logo:hover { color: var(--c-text); }

/* ---------- Фирменный загрузчик: контур эмблемы рисуется по кругу ---------- */
.loader { display: inline-flex; flex-direction: column; align-items: center; gap: var(--s-3); color: var(--c-text-muted); font-size: var(--fs-sm); }
.loader svg { width: 48px; height: 48px; overflow: visible; }
.loader path { fill: none; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.loader__track { stroke: var(--c-line-strong); }
.loader__line {
    stroke: var(--c-accent);
    stroke-dasharray: 100; stroke-dashoffset: 100;
    animation: loader-draw 1.8s cubic-bezier(.6, 0, .4, 1) infinite;
}
.loader__line--late { animation-delay: 0.25s; }
.loader__line--last { animation-delay: 0.5s; }
@keyframes loader-draw {
    0%   { stroke-dashoffset: 100; }
    55%  { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -100; }
}
@media (prefers-reduced-motion: reduce) {
    .loader__line { stroke-dashoffset: 0; animation: loader-pulse 2.4s ease-in-out infinite; }
    @keyframes loader-pulse { 50% { opacity: 0.35; } }
}

/* Загрузка таблицы: загрузчик поверх строк-заготовок */
.table-loading { position: relative; min-height: 240px; display: grid; place-items: center; }
.table-loading__rows { position: absolute; inset: 0; padding: var(--s-4); display: grid; gap: var(--s-4); align-content: start; opacity: 0.5; }
.table-loading__rows .skeleton { height: 14px; }
.table-loading .loader { position: relative; background: var(--c-bg); padding: var(--s-4) var(--s-5); border-radius: var(--r-2); }

/* ---------- Слово-логотип AtlanticA: большие «A» по краям ---------- */
.wordmark { display: inline-flex; flex-direction: column; align-items: center; color: var(--c-text); font-size: 1.25rem; }
.wordmark__row { display: flex; align-items: flex-end; line-height: 1; }
.wordmark__a { height: 1.55em; width: auto; overflow: visible; flex: none; }
.wordmark__mid {
    font: 600 1em/1 var(--f-display); letter-spacing: 0.05em; text-transform: uppercase;
    margin: 0 0.02em 0.04em;
}
.wordmark small {
    font: 500 0.4em/1 var(--f-text); letter-spacing: 0.32em; text-transform: uppercase;
    color: var(--c-text-muted); margin-top: 0.35em;
}
.logo .wordmark__a { width: auto; height: 1.55em; }

/* ---------- Панель-виджет (статус сервера, топ рейтинга, ближайшее событие) ---------- */
.panel { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-2); padding: var(--s-4) var(--s-5); }
.panel__title { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); margin-bottom: var(--s-3); }
.panel__title h3 { font-size: var(--fs-md); margin: 0; }
.panel__title a { font-size: var(--fs-sm); }

/* Мини-таблица топа */
.top-list { list-style: none; margin: 0; padding: 0; font-size: var(--fs-sm); }
.top-list li { display: grid; grid-template-columns: 24px 1fr auto; gap: var(--s-2); padding: var(--s-2) 0; border-top: 1px solid var(--c-line); }
.top-list li:first-child { border-top: 0; }
.top-list .rank { color: var(--c-text-faint); font-variant-numeric: tabular-nums; }
.top-list li:nth-child(-n+3) .rank { color: var(--c-accent); font-weight: 700; }
.top-list .num { font-variant-numeric: tabular-nums; color: var(--c-text-muted); }

/* ---------- Живая полоса сервера: под первым экраном, данные из базы ---------- */
.live-strip {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0;
    border: 1px solid var(--c-line); border-radius: var(--r-2); background: var(--c-surface);
}
.live-strip > div { padding: var(--s-3) var(--s-4); border-top: 1px solid var(--c-line); }
.live-strip > div:nth-child(-n+2) { border-top: 0; }
.live-strip > div:nth-child(even) { border-left: 1px solid var(--c-line); }
.live-strip dt { font-size: var(--fs-xs); color: var(--c-text-faint); }
.live-strip dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: var(--s-2); }
.live-strip a { color: inherit; text-decoration: none; }
.live-strip a:hover { color: var(--c-accent-hover); }
@media (min-width: 768px) {
    .live-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .live-strip > div { border-top: 0; }
    .live-strip > div + div { border-left: 1px solid var(--c-line); }
}

/* ---------- Патчноут: «было ⇒ стало» и фильтр по типу правки ---------- */
.diff { font-variant-numeric: tabular-nums; }
.diff s { color: var(--c-text-faint); text-decoration-thickness: 1px; }
.diff__arrow { color: var(--c-accent); margin: 0 0.35em; }
.diff b { color: var(--c-text); font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-5); }
.chip {
    min-height: 36px; padding: 0 var(--s-3); cursor: pointer;
    font: 500 var(--fs-sm) var(--f-text); color: var(--c-text-muted);
    background: transparent; border: 1px solid var(--c-line-strong); border-radius: var(--r-1);
}
.chip:hover { color: var(--c-text); }
.chip[aria-pressed="true"] { color: var(--c-on-accent); background: var(--c-accent); border-color: var(--c-accent); }
.chip span { opacity: 0.7; margin-left: 4px; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---------- Ссылка «Перейти к содержимому»: видна только с клавиатуры ---------- */
.skip-link { position: absolute; left: var(--s-4); top: -100px; z-index: 50; padding: var(--s-2) var(--s-4); background: var(--c-accent); color: var(--c-on-accent); }
.skip-link:focus { top: var(--s-2); }

/* ---------- Мобильное меню (до 1024px вместо основной навигации) ---------- */
.mobile-menu { position: relative; }
.mobile-menu summary {
    list-style: none; cursor: pointer; display: grid; place-items: center;
    width: 44px; height: 44px; border: 1px solid var(--c-line-strong); border-radius: var(--r-1);
}
.mobile-menu summary::-webkit-details-marker { display: none; }
.mobile-menu[open] summary { background: var(--c-surface-2); }
.mobile-menu nav {
    position: absolute; right: 0; top: calc(100% + var(--s-2)); min-width: 220px; z-index: 30;
    display: grid; padding: var(--s-2); background: var(--c-surface); border: 1px solid var(--c-line-strong); border-radius: var(--r-2);
}
.mobile-menu nav a { padding: var(--s-3) var(--s-3); color: var(--c-text); text-decoration: none; border-radius: var(--r-1); }
.mobile-menu nav a:hover, .mobile-menu nav a[aria-current="page"] { background: var(--c-surface-2); }
@media (min-width: 1024px) { .mobile-menu { display: none; } }

/* ---------- Подвал ---------- */
.site-footer { margin-top: var(--s-8); padding: var(--s-7) 0 var(--s-5); border-top: 1px solid var(--c-line); font-size: var(--fs-sm); }
.site-footer__grid { display: grid; gap: var(--s-6); }
.site-footer h3 { font-size: var(--fs-sm); color: var(--c-text-faint); font-weight: 500; margin-bottom: var(--s-3); }
.site-footer nav { display: grid; gap: var(--s-2); align-content: start; }
.site-footer nav a { color: var(--c-text-muted); text-decoration: none; }
.site-footer nav a:hover { color: var(--c-text); }
.site-footer__bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-2); margin-top: var(--s-6); padding-top: var(--s-4); border-top: 1px solid var(--c-line); color: var(--c-text-faint); font-size: var(--fs-xs); }
@media (min-width: 768px) { .site-footer__grid { grid-template-columns: 2fr 1fr 1fr; } }

/* ---------- Просмотр картинки на весь экран ---------- */
.lightbox { padding: 0; border: 0; background: transparent; max-width: 96vw; max-height: 96vh; }
.lightbox::backdrop { background: var(--c-backdrop); }
.lightbox img { max-width: 96vw; max-height: 88vh; border-radius: var(--r-2); }
.lightbox p { color: var(--c-text-muted); font-size: var(--fs-sm); margin: var(--s-2) 0 0; }
.lightbox button { position: fixed; top: var(--s-4); right: var(--s-4); }

/* ---------- Плашка предпросмотра нового дизайна (только админу) ---------- */
.design-bar { background: var(--c-accent); color: var(--c-on-accent); font-size: var(--fs-sm); }
.design-bar .container { display: flex; flex-wrap: wrap; gap: var(--s-3); justify-content: space-between; padding-top: var(--s-1); padding-bottom: var(--s-1); }
.design-bar a { color: var(--c-on-accent); font-weight: 600; }

/* Подсказка иностранцу «This site is also available in English» под шапкой (parts/lang_hint_v2.html) */
.lang-hint { background: var(--c-surface); border-bottom: 1px solid var(--c-accent); font-size: var(--fs-xs); color: var(--c-text-muted); }
.lang-hint__row { display: flex; align-items: center; gap: var(--s-1) var(--s-3); min-height: 44px; }
.lang-hint__text { margin: 0; }
.lang-hint__form { margin: 0; }
.lang-hint__go {
    padding: var(--s-2) 0; background: none; border: 0; cursor: pointer;
    font: 600 var(--fs-xs) var(--f-text); color: var(--c-accent);
    transition: color var(--t-fast);
}
.lang-hint__go:hover { color: var(--c-accent-hover); text-decoration: underline; }
.lang-hint__close {
    display: grid; place-items: center; width: 44px; height: 44px; margin-left: auto; margin-right: calc(-1 * var(--s-3));
    background: none; border: 0; border-radius: var(--r-1); color: var(--c-text-faint); cursor: pointer;
    transition: color var(--t-fast), background-color var(--t-fast);
}
.lang-hint__close:hover { color: var(--c-text); background: var(--c-surface-2); }
.lang-hint__go:focus-visible, .lang-hint__close:focus-visible { outline: 2px solid var(--c-focus); outline-offset: -2px; }
/* Телефон: текст и ссылка — две строки слева, крестик справа */
@media (max-width: 639px) {
    .lang-hint__row { display: grid; grid-template-columns: 1fr auto; padding-top: var(--s-2); }
    .lang-hint__text { grid-column: 1; }
    .lang-hint__form { grid-column: 1; }
    .lang-hint__close { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
}

/* ---------- Выпадающие меню шапки: «Ивенты» и меню аккаунта ---------- */
.icon--sm { width: 16px; height: 16px; }
.pop { position: relative; }
.pop > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: var(--s-1); }
.pop > summary::-webkit-details-marker { display: none; }
.pop > summary .icon--sm { transition: transform var(--t-fast); }
.pop[open] > summary .icon--sm { transform: rotate(180deg); }
.pop__panel {
    position: absolute; left: 0; top: calc(100% + var(--s-2)); z-index: 30; min-width: 240px;
    display: grid; padding: var(--s-2);
    background: var(--c-surface); border: 1px solid var(--c-line-strong); border-radius: var(--r-2);
    box-shadow: 0 12px 32px rgb(0 0 0 / 0.35);
}
.pop__panel--end { left: auto; right: 0; }
.pop__panel a { display: grid; gap: 2px; padding: var(--s-3); color: var(--c-text); text-decoration: none; border-radius: var(--r-1); border: 0; font-size: var(--fs-sm); }
.pop__panel a:hover, .pop__panel a[aria-current="page"] { background: var(--c-surface-2); }
.pop__panel a span { font-size: var(--fs-xs); color: var(--c-text-faint); font-weight: 400; }
/* Пункты меню «Ивенты»: SVG-иконка в рамке слева */
.nav-drop .pop__panel { min-width: 280px; }
.pop__panel a.nav-ev { grid-template-columns: 36px minmax(0, 1fr); column-gap: var(--s-3); align-items: center; }
.nav-ev__icon { grid-row: span 2; display: grid; place-items: center; width: 36px; height: 36px; background: var(--c-bg); border: 1px solid var(--c-line-strong); border-radius: var(--r-1); color: var(--c-accent); font-style: normal; transition: border-color var(--t-fast); }
.nav-ev__icon svg { width: 20px; height: 20px; }
.pop__panel a.nav-ev:hover .nav-ev__icon, .pop__panel a.nav-ev[aria-current="page"] .nav-ev__icon { border-color: var(--c-accent); }

.site-nav .nav-drop > summary {
    color: var(--c-text-muted); font-weight: 500; font-size: var(--fs-sm);
    padding: var(--s-2) 0; border-bottom: 2px solid transparent;
}
.site-nav .nav-drop > summary:hover { color: var(--c-text); }
.site-nav .nav-drop > summary[aria-current="page"] { color: var(--c-text); border-bottom-color: var(--c-accent); }

/* Аккаунт: латунный кружок с первой буквой — сразу видно, что вы вошли */
.user-menu > summary {
    min-height: 44px; padding: 0 var(--s-3); gap: var(--s-2);
    border: 1px solid var(--c-line-strong); border-radius: var(--r-1);
    font-weight: 600; font-size: var(--fs-sm);
}
.user-menu > summary:hover, .user-menu[open] > summary { background: var(--c-surface-2); }
.avatar {
    display: grid; place-items: center; width: 34px; height: 34px; flex: none;
    font: 600 var(--fs-sm) var(--f-display); color: var(--c-on-accent);
    background: var(--c-accent); border-radius: 50%;
}
.user-menu__icon { color: var(--c-accent); }
.user-menu__name { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu__who { margin: 0; padding: var(--s-2) var(--s-3) var(--s-3); font-size: var(--fs-xs); color: var(--c-text-faint); border-bottom: 1px solid var(--c-line); margin-bottom: var(--s-2); }
.user-menu__who b { color: var(--c-text); font-weight: 600; }
.pop__panel .user-menu__admin { color: var(--c-accent-2); }
.pop__panel .user-menu__out { margin-top: var(--s-2); border-top: 1px solid var(--c-line); border-radius: 0; color: var(--c-text-muted); }
@media (max-width: 639px) {
    .user-menu__name, .user-menu__chev { display: none; }
    .user-menu > summary { padding: 0; width: 44px; justify-content: center; }
}

/* ---------- Логотипы сервисов (спрайт brands.svg) ---------- */
.icon--brand { width: 20px; height: 20px; flex: none; vertical-align: -4px; }
.with-icon, .site-footer__social a { display: inline-flex; align-items: center; gap: var(--s-2); }

/* ---------- Окно подтверждения (<dialog class="confirm">) ---------- */
.confirm {
    width: min(480px, calc(100vw - 2 * var(--gutter))); padding: 0;
    color: var(--c-text); background: var(--c-surface);
    border: 1px solid var(--c-line-strong); border-radius: var(--r-2);
    box-shadow: 0 24px 64px rgb(0 0 0 / 0.5);
}
.confirm::backdrop { background: rgb(8 12 15 / 0.72); }
.confirm[open] { animation: confirm-in var(--t-base) both; }
@keyframes confirm-in { from { opacity: 0; transform: translateY(8px); } }
.confirm__box { display: grid; gap: var(--s-4); padding: var(--s-6); border-top: 3px solid var(--c-accent); }
.confirm__title { margin: 0; font-size: var(--fs-xl); }
.confirm__text { margin: 0; color: var(--c-text-muted); font-size: var(--fs-sm); }
.confirm__preview { display: grid; gap: var(--s-2); padding: var(--s-4); background: var(--c-bg); border: 1px solid var(--c-line); border-radius: var(--r-1); }
.confirm__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s-3); margin-top: var(--s-2); }

/* ---------- Поле пароля с кнопкой-глазом ---------- */
.pw { position: relative; display: flex; }
.pw input { flex: 1; min-width: 0; width: 100%; box-sizing: border-box; padding-right: 48px; }
.pw__toggle {
    position: absolute; right: 4px; top: 4px; bottom: 4px;
    display: grid; place-items: center; width: 40px; padding: 0;
    font: 500 var(--fs-sm) var(--f-text); color: var(--c-text-muted);
    background: transparent; border: 0; border-radius: var(--r-1); cursor: pointer;
}
.pw__toggle:hover { color: var(--c-text); background: var(--c-surface-2); }
.pw__toggle:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 0; }

/* ---------- Загрузка «прилив и кристалл» (templates/parts/loader_v2.html + brand/loader.js) ----------
   Латунь поднимается по букве и стоит (без мигания); по окончании — долив, в центре вспыхивает кристалл. */
.brand-loader { display: grid; justify-items: center; gap: var(--s-3); color: var(--c-text-muted); font-size: var(--fs-sm); }
.brand-loader[hidden] { display: none; }
.brand-loader__mark { width: 72px; height: 72px; overflow: visible; }
.brand-loader__dim { fill: var(--c-accent); opacity: 0.18; }
.brand-loader__fill { fill: var(--c-accent); }
.brand-loader__tide {
    transform-box: fill-box; transform: translateY(100%);
    animation: tide-rise 1s ease-out forwards, tide-creep 8s 1s ease-out forwards;
}
@keyframes tide-rise { from { transform: translateY(100%); } to { transform: translateY(18%); } }
@keyframes tide-creep { from { transform: translateY(18%); } to { transform: translateY(4%); } }
.brand-loader__gem, .brand-loader__wave { transform-box: fill-box; transform-origin: center; opacity: 0; }
.brand-loader__gem { fill: var(--c-accent-2); }
.brand-loader__wave { fill: none; stroke: #BFE3DD; stroke-width: 1.6; }
.brand-loader.is-done .brand-loader__gem { animation: gem-in 0.45s 0.2s ease-out forwards; }
.brand-loader.is-done .brand-loader__wave { animation: gem-wave 0.55s 0.28s ease-out forwards; }
@keyframes gem-in {
    0% { opacity: 0; transform: scale(0.3); fill: #BFE3DD; }
    55% { opacity: 1; transform: scale(1.15); fill: #BFE3DD; }
    100% { opacity: 1; transform: scale(1); fill: var(--c-accent-2); }
}
@keyframes gem-wave { 0% { opacity: 0.9; transform: scale(1); } 100% { opacity: 0; transform: scale(3.2); } }
/* Поверх блока (карточка входа, окно покупки) */
.brand-loader--overlay {
    position: absolute; inset: 0; z-index: 5; align-content: center;
    background: var(--c-backdrop); border-radius: inherit;
}
@media (prefers-reduced-motion: reduce) {
    .brand-loader__tide { animation: none; transform: none; }
    .brand-loader__gem { opacity: 1; }
    .brand-loader.is-done .brand-loader__gem, .brand-loader.is-done .brand-loader__wave { animation: none; }
}

/* Discord и ВК в шапке: иконки-ссылки (на телефоне — внизу мобильного меню) */
.header-social { display: none; align-items: center; gap: var(--s-1); }
.header-social a {
    display: grid; place-items: center; width: 40px; height: 40px;
    color: var(--c-text-muted); border-radius: var(--r-1);
    transition: color var(--t-fast), background-color var(--t-fast);
}
.header-social a:hover { color: var(--c-text); background: var(--c-surface-2); }
/* Родной размер иконок — 24 px: без масштабирования они не мылятся */
.header-social .icon--brand { width: 24px; height: 24px; vertical-align: 0; }
@media (min-width: 1024px) { .header-social { display: flex; } }
.mobile-menu__social { display: flex; gap: var(--s-4); margin-top: var(--s-3); padding-top: var(--s-3); border-top: 1px solid var(--c-line); }
.mobile-menu__social a { display: inline-flex; align-items: center; gap: var(--s-2); }

/* Переключатель языка в шапке: RU / EN, текущий подчёркнут латунью, как пункт меню */
.lang-switch { display: flex; align-items: center; }
.lang-switch button {
    min-width: 36px; min-height: 44px; padding: 0 var(--s-1);
    background: none; border: 0; border-bottom: 2px solid transparent;
    font: 600 var(--fs-xs) var(--f-display); letter-spacing: 0.04em;
    color: var(--c-text-faint); cursor: pointer;
    transition: color var(--t-fast), border-color var(--t-fast);
}
.lang-switch button:hover { color: var(--c-text); }
.lang-switch button[aria-current="true"] { color: var(--c-text); border-bottom-color: var(--c-accent); cursor: default; }
.lang-switch button:focus-visible { outline: 2px solid var(--c-focus); outline-offset: -2px; }

/* Скрыто с экрана, но читается экранными дикторами (подписи полей поиска и т. п.) */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Значок непрочитанных ответов и упоминаний (обсуждения) в меню аккаунта */
.cm-dot { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px;
    font-size: 11px; font-weight: 600; color: var(--c-on-accent); background: var(--c-accent); border-radius: 9px; }
.user-menu > summary { position: relative; }
.user-menu > summary .cm-dot { position: absolute; top: 2px; left: 22px; min-width: 8px; height: 8px; padding: 0; }
.pop__panel a.user-menu__notif { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
