/* ============================================================================
   base.css — общая база: цветовые переменные, сброс, сайдбар, разметка main,
   плашка приветствия, полоска "Вы: <ник>" в подвале сайдбара, общие стили
   модалок (ввод ника / загрузка), адаптив под мобилки.
   ============================================================================ */

  /* ============================================================================
     DESIGN TOKENS — glassmorphism редизайн (см. /areas/slyrix-redesign.md)
     Палитра/шрифты — рабочий вариант из демок, не финал, но это следующая
     точка отсчёта. platform-twitch/platform-youtube акцентные переопределения
     ниже по файлу — намеренно оставлены на следующий кусок переноса (карточки),
     здесь трогаем только базовые токены.
     ============================================================================ */
  /* ============================================================================
     DESIGN TOKENS — glassmorphism редизайн (см. /areas/slyrix-redesign.md)
     Значения сверены с одобренной демкой liquid_glass_demo_v3.html — это
     источник истины по числам (radius/blur/тени), не додумывать заново.
     platform-twitch/platform-youtube акцентные переопределения ниже по
     файлу — намеренно оставлены на следующий кусок переноса (карточки).
     ============================================================================ */
  @property --accent{
    syntax:'<color>';
    inherits:true;
    initial-value:#e8b4d8;
  }
  @property --accent-dim{
    syntax:'<color>';
    inherits:true;
    initial-value:rgba(232, 180, 216, 0.28);
  }
  @property --bg{
    syntax:'<color>';
    inherits:true;
    initial-value:#100e17;
  }
  @property --panel{
    syntax:'<color>';
    inherits:true;
    initial-value:#12111a;
  }
  @property --panel-2{
    syntax:'<color>';
    inherits:true;
    initial-value:#191826;
  }
  @property --border{
    syntax:'<color>';
    inherits:true;
    initial-value:rgba(255,255,255,0.14);
  }
  @property --text{
    syntax:'<color>';
    inherits:true;
    initial-value:#f3eef6;
  }
  @property --muted{
    syntax:'<color>';
    inherits:true;
    initial-value:#a8a0b8;
  }
  @property --muted-2{
    syntax:'<color>';
    inherits:true;
    initial-value:#6f6884;
  }
  :root{
    /* --- цвета поверхностей / текста (сверено с demo v3 :root) --- */
    --bg: #100e17;
    --panel: #12111a;      /* используется как fallback-фон под .frosted, если backdrop-filter не поддерживается */
    --panel-2: #191826;
    --border: rgba(255,255,255,0.14);
    --text: #f3eef6;
    --muted: #a8a0b8;
    --muted-2: #6f6884;

    /* --- брендовый акцент (единый для всех платформ) --- */
    --accent: #e8b4d8;              /* demo: --glow-mauve */
    --accent-dim: rgba(232, 180, 216, 0.28);
    --accent-2: #8b7cf6;            /* demo: --glow-violet — вторичный акцент для градиентов рядом с --accent */

    /* --- стекло (имена соответствуют demo v3: --glass, --glass-border) --- */
    --glass: rgba(255,255,255,0.05);
    --glass-border: rgba(255,255,255,0.14);
    --glass-blur: blur(24px) saturate(150%);
    --glass-blur-fallback: blur(14px); /* используется когда .reduce-glass-fx активен, см. ниже */

    /* --- тень/блик карточки --- */
    --glass-shadow: 0 8px 40px rgba(0,0,0,0.35);
    --glass-highlight: inset 0 1px 0 rgba(255,255,255,0.08);

    /* --- семантические цвета: НЕ трогать под глассморфизм, несут функциональный смысл
       (имена -c сохранены как в demo v3: --mute-c/--ban-c/--del-c/--ok-c) --- */
    --mute-c: #f2c169;       /* автомут / предупреждение */
    --mute-dim: rgba(242, 193, 105, 0.16);
    --ban-c: #ef7b8f;        /* бан / деструктив */
    --ban-dim: rgba(239, 123, 143, 0.16);
    --del-c: #7fb8e0;        /* удаление / нейтральное действие */
    --del-dim: rgba(127, 184, 224, 0.16);
    --ok-c: #7fe0b8;         /* ок / онлайн / выполнено — единый зелёный статус-токен
                                 (раньше было три разных хардкода: #7d8f7a, #4ade80, #2ecc71) */
    --ok-dim: rgba(127, 224, 184, 0.16);

    /* --- роли и бейджики: отдельная категория от статус-семантики выше,
       не путать --role-* с --ban-c/--ok-c и т.п. --- */
    --role-admin: var(--accent-2);              /* фиолет — админ, полный доступ */
    --role-admin-dim: rgba(139, 124, 246, 0.18);
    --role-senior: var(--accent);                /* малиновый — старший модератор, доступ к предложке */
    --role-senior-dim: var(--accent-dim);
    --role-mod: var(--del-c);                     /* синий — базовый подтверждённый модератор, без доп. прав */
    --role-mod-dim: var(--del-dim);
    --role-supporter: var(--accent);              /* розовая рамка на значке саппортера — тот же малиновый */
    --role-supporter-dim: var(--accent-dim);
    --role-beta: #05dcd4;                         /* бирюза — снята пипеткой с иконки кота Влада */
    --role-beta-dim: rgba(5, 220, 212, 0.16);
    --role-notify: #f5b942;                       /* янтарь — получатель уведомлений, отдельно от нейтральных кастомных ролей */
    --role-notify-dim: rgba(245, 185, 66, 0.16);

    /* --- алиасы под старые имена токенов (--radius/--ban/--mute/--del/--success) ---
       Нужны, пока content.css/feedback.css/videos.css ещё не тронуты в переносе
       и продолжают ссылаться на старые имена. Как только эти файлы будут
       переведены на -c/--radius-md имена явно, алиасы можно будет убрать —
       не убирать раньше времени, иначе сломается нетронутый CSS. */
    --radius: var(--radius-md);
    --ban: var(--ban-c);
    --mute: var(--mute-c);
    --del: var(--del-c);
    --success: var(--ok-c);
    --success-dim: var(--ok-dim);

    /* --- шрифты --- */
    --font-display: 'Fraunces', serif;            /* заголовки (h1, h2.sub-h), бренд, profile-info — НЕ везде подряд */
    --font-body: 'Plus Jakarta Sans', sans-serif; /* тело текста, кнопки, UI — дефолт на body */
    --font-mono: 'JetBrains Mono', monospace;     /* только тех. данные: .path, .cmd-name, .cmd-timer, .cmd-row.head, время в логах */

    /* --- радиусы: три уровня, как в demo v3 (--radius-lg/md/sm) --- */
    --radius-lg: 26px;  /* сайдбар, модалка, крупные панели (profile-card) */
    --radius-md: 18px;  /* обычные карточки: rule-card, answer-card, chat-example, feedback-card, about-link, cmd-table */
    --radius-sm: 12px;  /* кнопки, инпуты, textarea, small controls */
    --radius-pill: 20px; /* пилюли: .tag, .chip, .verdict, .perm, .platform-badge, .profile-role — отдельный паттерн, не путать с --radius-sm */

    color-scheme: dark;
  }

  /* Флаг деградации glass-эффекта — переключается в JS фичедетектом
     (слабое устройство / мобилка без поддержки сложных backdrop-filter).
     --glass-blur-fallback используется вместо полного эффекта. */
  html.reduce-glass-fx{
    --glass-blur: var(--glass-blur-fallback);
  }

  *{box-sizing:border-box; margin:0; padding:0; -webkit-tap-highlight-color:transparent;}
  html{scroll-behavior:smooth; height:100%;}
  /* html,body высотой 100% — нужно, чтобы .sidebar мог быть
     height:calc(100vh - 48px) в потоке (position:relative), а не через
     position:fixed; .main получает свой overflow-y:auto и скроллится
     независимо от сайдбара (см. .sidebar/.main ниже). */
  body{
    background:var(--bg);
    color:var(--text);
    font-family:var(--font-body);
    height:100%;
    display:flex;
    line-height:1.5;
    overflow-x:hidden;
    position:relative;
    transition: background 0.35s ease, color 0.35s ease, --bg 0.35s ease, --panel 0.35s ease, --panel-2 0.35s ease, --border 0.35s ease, --text 0.35s ease, --muted 0.35s ease, --muted-2 0.35s ease, --accent 0.35s ease;
  }
  ::selection{background:var(--accent-dim); color:var(--text);}

  /* ---------- AMBIENT BLOBS (фоновые размытые пятна — часть "glow" стиля demo v3) ----------
     Три фиксированных blur-градиента за контентом, создают ощущение света
     позади стекла. Разметка добавляется один раз в index.html:
       <div class="ambient"><div class="blob blob-1"></div><div class="blob blob-2"></div><div class="blob blob-3"></div></div>
     На .reduce-glass-fx blur(100px) может быть дорогим на слабых устройствах —
     если понадобится, здесь же добавим сокращённый вариант (см. TODO ниже). */
  .ambient{ position:fixed; inset:0; z-index:0; overflow:hidden; pointer-events:none; }
  .blob{ position:absolute; border-radius:50%; filter:blur(100px); opacity:0.55; }
  .blob-1{ width:560px; height:560px; background:radial-gradient(circle, var(--accent), transparent 70%); top:-140px; left:-100px; }
  .blob-2{ width:480px; height:480px; background:radial-gradient(circle, var(--accent-2), transparent 70%); bottom:-160px; left:32%; opacity:0.32; }
  .blob-3{ width:400px; height:400px; background:radial-gradient(circle, var(--accent), transparent 70%); top:15%; right:-120px; opacity:0.28; }
  html.reduce-glass-fx .blob{ filter:blur(48px); } /* TODO: не проверено на слабых устройствах — если всё ещё тяжело, рассмотреть display:none */

  /* ---------- .frosted — базовый однослойный glass-класс для карточек/панелей ----------
     Это НЕ то же самое, что 4-слойная liquid-glass модалка ниже (.lg-*) —
     в demo v3 обычные карточки (sidebar, rule-card, answer-card, cmd-table,
     chat-example, feedback-card, about-link, profile-card) используют только
     .frosted, без отдельных слоёв. */
  .frosted{
    background:var(--glass);
    border:1px solid var(--glass-border);
    backdrop-filter:var(--glass-blur);
    -webkit-backdrop-filter:var(--glass-blur);
    box-shadow:var(--glass-shadow), var(--glass-highlight);
  }

  /* Декоративные/служебные элементы — бейджи, теги, названия команд и т.п. —
     не должны копироваться, это раздражает при выделении текста рядом.
     Реальный смысловой текст (описания, ответы бота, причины) остаётся выделяемым. */
  .tag, .chip, .perm, .verdict, .cmd-name, .cmd-timer,
  .platform-icon, .answer-user, .answer-date, .moderator-bar-name,
  .brand, .brand-sub, .path, .nav-item, .answer-checkbox label,
  .chat-user, .sidebar-footer, .modal-icon{
    user-select:none;
    -webkit-user-select:none;
    -moz-user-select:none;
  }
  /* Профиль: ник, роль, бейдж платформы, tfa-badge, заголовок "Платформа" —
     тоже не должны копироваться при случайном выделении. */
  #profile-nickname, #profile-role, #profile-platform-badge,
  .tfa-badge, .profile-section-title{
    user-select:none;
    -webkit-user-select:none;
    -moz-user-select:none;
  }

  /* ---------- SIDEBAR ---------- */
  .sidebar{
    width:248px;
    flex-shrink:0;
    /* фон/тень/блюр — через .frosted (навешен в index.html), здесь не дублируем.
       Плавающая карточка, как в демках (admin_demo.html / liquid_glass_demo_v3.html):
       position:relative + margin со всех сторон + свой border-radius + собственная
       высота, а не position:fixed вплотную к краю (как было раньше). */
    display:flex;
    flex-direction:column;
    position:relative;
    z-index:2;
    margin:24px 0 24px 24px;
    border-radius:var(--radius-lg);
    height:calc(100vh - 48px);
    padding:28px 20px;
  }
  .brand{
    font-family:var(--font-display);
    font-size:20px;
    font-weight:500;
    letter-spacing:-0.01em;
    margin-bottom:2px;
    padding:0 6px;
  }
  .brand span{color:var(--accent);}
  .brand-sub{
    font-family:var(--font-body);
    font-size:11.5px;
    color:var(--muted-2);
    margin-bottom:28px;
    padding:0 6px;
  }
  nav{display:flex; flex-direction:column; gap:8px; position:relative;}
  .nav-indicator{
    position:absolute;
    top:0; left:0;
    background:linear-gradient(135deg, var(--accent-dim), rgba(139,124,246,0.1));
    box-shadow:inset 0 0 0 1px rgba(232,180,216,0.3);
    border-radius:var(--radius-sm);
    z-index:0;
    pointer-events:none;
    transition:transform 0.32s cubic-bezier(0.4,0,0.2,1), width 0.32s cubic-bezier(0.4,0,0.2,1), height 0.32s cubic-bezier(0.4,0,0.2,1);
  }
  .nav-item{
    position:relative;
    z-index:1;
    font-family:var(--font-body);
    font-size:13.5px;
    font-weight:500;
    color:var(--muted);
    background:none;
    border:none;
    text-align:left;
    padding:11px 13px;
    border-radius:var(--radius-sm);
    cursor:pointer;
    display:flex;
    align-items:center;
    gap:10px;
    transition:background 0.25s ease, color 0.25s ease, transform 0.15s cubic-bezier(0.4,0,0.2,1);
    width:100%;
  }
  .nav-item:hover:not(.active){background:rgba(255,255,255,0.06); color:var(--text);}
  .nav-item:active{transform:scale(0.97);}
  .nav-item.active{background:transparent; color:var(--text);}
  .nav-item .dot{
    width:6px; height:6px; border-radius:50%;
    background:var(--muted-2);
    flex-shrink:0;
    transition:background 0.25s ease, box-shadow 0.25s ease;
  }
  .nav-item.active .dot{background:var(--accent); box-shadow:0 0 10px var(--accent);}
  .nav-icon{
    display:inline-flex;
    width:16px;
    height:16px;
    flex-shrink:0;
    align-items:center;
    justify-content:center;
  }
  .nav-icon svg{
    width:16px;
    height:16px;
    display:block;
  }
  .nav-icon-cat svg{
    color:var(--accent);
  }

  .sidebar-footer{
    margin-top:auto;
    padding-top:14px;
    font-family:var(--font-body);
    font-size:12px;
    color:var(--muted-2);
    line-height:1.6;
    padding-left:6px;
    padding-right:6px;
  }
  .sidebar-mod-row{
    display:flex;
    align-items:center;
    flex-wrap:wrap;
    gap:6px;
    margin-bottom:8px;
    font-size:12px;
  }
  .sidebar-mod-row strong{color:var(--text);}
  /* ---------- бейдж платформы (twitch/youtube) — только идентификатор рядом
     с ником в футере сайдбара и на Профиле, НЕ меняет --accent/тему сайта
     (см. /areas/slyrix-redesign.md — раньше это делал applyPlatformAccent,
     убрано как баг). Единый акцентный цвет для обеих платформ, разница
     только в иконке/тексте — сверено с mobile_dock_demo.html. ---------- */
  .platform-badge{
    display:inline-flex;
    align-items:center;
    gap:4px;
    flex-shrink:0;
    font-family:var(--font-body);
    font-size:10.5px;
    font-weight:600;
    padding:3px 9px;
    border-radius:var(--radius-pill);
    color:var(--accent);
    background:var(--accent-dim);
    border:1px solid var(--accent);
    text-transform:lowercase;
  }
  /* Контейнеры бейджа (в футере сайдбара и на Профиле) — рендерятся через
     innerHTML в renderPlatformBadges() (moderator.js), сама подстановка
     контента не анимируется браузером, поэтому JS сначала гасит opacity,
     подменяет содержимое, затем возвращает — плавный кросс-фейд вместо
     мгновенной подмены. */
  #moderator-platform-badge, #profile-platform-badge{
    display:inline-flex;
    transition:opacity 0.18s ease;
  }
  .platform-badge svg{
    width:11px;
    height:11px;
    display:block;
  }
  /* На мобильных в профиле скрываем текст платформы, оставляем только иконку */
  @media (max-width: 820px){
    #profile-platform-badge .platform-badge{
      padding:0;
      width:22px;
      height:22px;
      border-radius:50%;
      display:inline-flex;
      align-items:center;
      justify-content:center;
    }
    #profile-platform-badge .platform-text{
      display:none;
    }
    #profile-platform-badge .platform-badge svg{
      width:12px;
      height:12px;
      display:block;
    }
  }
  .sidebar-footer .moderator-bar-change{
    margin-left:0;
    width:100%;
    text-align:center;
  }
  .sidebar-footer-note{
    margin-top:10px;
  }

  /* ---------- MAIN ----------
     Раньше margin-left:248px компенсировал position:fixed сайдбара — теперь
     сайдбар в потоке (position:relative), flex сам отдаёт .main оставшееся
     место, хак не нужен.
     ВАЖНО: max-width здесь раньше и был багом со "скроллбаром посередине
     экрана" — .main одновременно flex:1 (растягивается на всё оставшееся
     место) И max-width:900px (сам ограничен по ширине). На широком мониторе
     это оставляет пустой promежуток справа от .main, и его собственный
     overflow-y:auto рисует скроллбар на границе этих 900px, а не у правого
     края окна. Фикс: .main теперь full-bleed (без max-width) — ограничение
     ширины контента переехало на .section/.guest-stub ниже.
     ВТОРОЙ БАГ (после первого фикса): .main.overflow-y:auto скроллился по
     САМОЙ ДЛИННОЙ секции среди всех, т.к. все .section — position:absolute
     (нужно для устранения мерцания, см. комментарий у .section ниже) и
     абсолютные потомки участвуют в overflow родителя, даже когда невидимы
     (opacity:0). Стоя на короткой вкладке, можно было проскроллить в
     пустоту на высоту самой длинной другой (админка/ответы).
     Фикс: .main сам больше не скроллится (overflow:hidden) — скроллится
     каждая .section отдельно (overflow-y:auto + inset:0 задаёт ей высоту
     ровно в размер .main). Скролл каждой вкладки независимый и не течёт
     в другие. */
  .main{
    flex:1;
    min-width:0;
    position:relative;
    z-index:1;
    height:100%;
    overflow:hidden;
  }
  .path{
    font-family:var(--font-mono);
    font-size:12px;
    color:var(--muted-2);
    margin-bottom:14px;
    letter-spacing:0.04em;
  }
  .path .accent{color:var(--accent);}
  h1{
    font-family:var(--font-display);
    font-size:32px;
    font-weight:500;
    margin-bottom:10px;
    letter-spacing:-0.015em;
  }
  h2.sub-h{
    font-family:var(--font-display);
    font-weight:500;
    font-size:20px;
    margin:36px 0 14px;
  }
  .lead{
    color:var(--muted);
    font-size:15px;
    margin-bottom:32px;
    max-width:56ch;
    line-height:1.6;
  }
  /* Было (попытка №2): position:absolute + opacity 0↔1. Секция никогда не
     выпадала из дерева рендера (в отличие от display:none/visibility:hidden
     из попытки №1), так что backdrop-filter слой не уничтожался целиком —
     но браузер (подтверждено в Firefox и Chromium — фундаментальное
     поведение backdrop-filter как GPU-оптимизации, не баг одного движка)
     всё равно не досчитывает блюр, пока элемент близок к opacity:0: пока
     opacity растёт от 0 к 1, блюр "доезжает" вместе с ним — серые карточки
     на всём протяжении fade, розовые только когда анимация закончилась.
     Плюс три параллельные анимации при клике (nav-индикатор + opacity +
     translateY) давали ощутимую дёрганность.
     Финальный фикс: НИКОГДА не трогаем opacity (всегда 1) — вместо этого
     секция целиком уезжает transform:translateY(...) за пределы .main
     (см. .main{overflow:hidden} выше), в сторону, соответствующую порядку
     пункта в сайдбаре (ниже текущего → снизу, выше → сверху). Раз opacity
     никогда не приближается к 0, у браузера нет повода "остывать" блюр —
     слайд визуально маскирует любую остаточную задержку в блюре, а не
     выставляет её напоказ как при чистом fade. Направление и мгновенные
     прыжки (без анимации, для не-кликовых ресинков вроде логина/гостя)
     считает JS — см. activateSection()/resetAllSectionsInstant() в nav.js. */
  /* Скроллбар у .section рисуется на границе её собственной ширины
     (max-width:900px), а не у истинного правого края .main — тот же
     эффект "скроллбара посередине экрана", что и раньше, просто теперь
     на уровень ниже (скроллится сама .section, а не .main). Раздельный
     контейнер под скролл (на всю ширину .main) — правильный фикс, но
     сложнее (нужна обёртка внутри каждой .section в HTML); скрываем
     скроллбар визуально — скролл колесом/тачем/клавиатурой работает как
     обычно, просто без видимой полосы. */
  .section{
    position:absolute;
    inset:0;
    overflow-y:auto;
    scrollbar-width:none;
    -ms-overflow-style:none;
    max-width:900px;
    margin:0;
    padding:48px 56px 100px;
    opacity:1;
    pointer-events:none;
    transform:translateY(100%) translateZ(0);
    transition:transform 0.32s cubic-bezier(0.34, 1.15, 0.3, 1);
  }
  .section::-webkit-scrollbar{display:none;}
  .section.active{
    pointer-events:auto;
    transform:translateY(0) translateZ(0);
  }

  /* greeting box */
  .greet{
    font-family:var(--font-body);
    font-size:13px;
    color:var(--accent);
    background:var(--accent-dim);
    border:1px solid var(--accent);
    border-radius:var(--radius-md);
    padding:14px 16px;
    margin-bottom:32px;
  }


  /* ---- Guest stub (показывается вместо контента для незалогиненных) ---- */
  .guest-stub {
    display: none;
    position: absolute;
    inset: 0;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
    padding: 128px 56px 100px;
    min-height: 50vh;
  }
  .guest-stub::-webkit-scrollbar{display:none;}
  .guest-stub.active {
    display: flex;
  }
  .guest-stub-icon {
    color: var(--muted-2);
    margin-bottom: 20px;
  }
  .guest-stub-icon svg {
    width: 48px;
    height: 48px;
  }
  .guest-stub h2 {
    font-family: 'Inter', sans-serif;
    font-size: 22px;
    margin-bottom: 10px;
    color: var(--text);
  }
  .guest-stub p {
    font-size: 14px;
    color: var(--muted);
    max-width: 36ch;
    margin-bottom: 24px;
    line-height: 1.5;
  }
  .guest-stub .modal-submit {
    max-width: 220px;
  }

  /* ---- Profile section ---- */
  .profile-card {
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 480px;
  }
  .profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
  }
  .profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    background: var(--panel-2);
    flex-shrink: 0;
  }
  .profile-avatar-placeholder {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--panel-2);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .profile-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }
  .profile-role-row {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
  }
  .profile-info h1 {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 22px;
    margin-bottom: 0;
  }
  .profile-role {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-dim);
    border: 1px solid currentColor;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    display: inline-block;
  }
  .profile-role.role-admin { color: var(--role-admin); background: var(--role-admin-dim); }
  .profile-role.role-senior_moderator { color: var(--role-senior); background: var(--role-senior-dim); }
  .profile-role.role-moderator { color: var(--role-mod); background: var(--role-mod-dim); }

  /* ---- Ник + роль-пилюля в узких инлайн-контекстах (комментарии
     claimed_by/commented_by в предложках) — badges.js:
     nicknameWithBadgesHtml(). Не путать с .profile-role-row (шапка
     профиля, крупнее и в отдельной строке). ---- */
  .nickname-with-role{
    display:inline-flex;
    align-items:center;
    gap:6px;
    flex-wrap:wrap;
  }
  .nickname-with-role .profile-role{
    font-size:10.5px;
    padding:2px 8px;
  }

  /* ---- Круглые бейджики (supporter/beta_tester и любые кастомные с иконкой) ----
     Ряд из .role-badge-row рядом с ником — не влияют на права, чисто визуал.
     Цвет задаётся через data-role, см. role-badge-icon-colors ниже. */
  .role-badge-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    vertical-align: middle;
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .role-badge-circle {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--muted-2);
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s ease, background 0.15s ease;
  }
  .role-badge-circle:hover { transform: scale(1.08); }
  .role-badge-circle svg { width: 12px; height: 12px; }
  .role-badge-circle[data-role="supporter"] {
    border-color: var(--role-supporter);
    color: var(--role-supporter);
    background: var(--role-supporter-dim);
  }
  .role-badge-circle[data-role="beta_tester"] {
    border-color: var(--role-beta);
    color: var(--role-beta);
    background: var(--role-beta-dim);
  }

  /* ---- Кастомные роли без заведённой иконки — нейтральная серая метка,
     чтобы выданная роль не пропадала визуально совсем. ---- */
  .role-badge-custom {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 600;
    color: var(--ok-c);
    background: var(--ok-dim);
    border: 1px solid currentColor;
    padding: 2px 9px;
    border-radius: var(--radius-pill);
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
  }
  /* Роли из LABEL_ROLES (badges.js) — служебные, но заведённые: свой цвет,
     чтобы не путать с истинно кастомными строками из .role-badge-custom. */
  .role-badge-custom[data-role="notify_recipient"] {
    color: var(--role-notify);
    background: var(--role-notify-dim);
  }

  .role-badge-popover {
    position: absolute;
    z-index: 50;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 10px);
    padding: 10px 14px;
    min-width: 180px;
    max-width: 240px;
    box-shadow: var(--glass-shadow);
  }
  .role-badge-popover-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
  }
  .role-badge-popover-title svg { width: 15px; height: 15px; flex-shrink: 0; }
  .role-badge-popover-text {
    font-size: 12px;
    color: var(--muted);
    margin: 0;
  }
  .profile-tfa-row {
    margin-bottom: 20px;
  }
  .tfa-badge {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    color: var(--ok-c);
    background: var(--ok-dim);
    border: 1px solid rgba(127, 224, 184, 0.35);
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    display: inline-block;
    transition: opacity 0.2s ease;
  }
  .tfa-badge:hover {
    opacity: 0.8;
  }
  .profile-actions {
    display: flex;
    gap: 10px;
  }
  .profile-actions .modal-submit {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }
  .profile-actions .modal-submit svg {
    flex-shrink: 0;
  }
  .tfa-info-details {
    text-align: left;
    margin: 8px 0 0;
  }
  .tfa-info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
  }
  .tfa-info-row:last-child {
    border-bottom: none;
  }
  .tfa-info-label {
    color: var(--muted-2);
  }
  .tfa-info-value {
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 12px;
  }

  .profile-section-title {
    font-family: var(--font-body);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    margin: 20px 0 10px;
  }
  .profile-theme-row {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
  }
  .profile-theme-btn {
    flex: 1;
  }

  /* ---- Тумблеры настроек интерфейса ---- */
  .profile-toggles {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 14px;
  }
  .profile-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    padding: 12px 8px;
    min-height: 48px;
    touch-action: manipulation;
  }
  .profile-toggle input[type="checkbox"].toggle-input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
  }
  .toggle-track {
    position: relative;
    width: 40px;
    height: 22px;
    border-radius: var(--radius-pill);
    background: var(--muted-2);
    flex-shrink: 0;
    transition: background 0.2s ease;
  }
  .toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease;
  }
  .toggle-input:checked + .toggle-track {
    background: var(--accent);
  }
  .toggle-input:checked + .toggle-track::after {
    transform: translateX(18px);
  }
  .toggle-input:focus-visible + .toggle-track {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }
  .profile-toggle-label {
    font-size: 13px;
    color: var(--text);
  }

  /* ---- Классы body для тумблеров ---- */
  body.reduce-blur .frosted {
    background: rgba(18, 17, 26, 0.85);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  /* Понижение движения - упрощает анимации (fade вместо slide+bounce) */
  body.reduce-motion .section {
    transition: opacity 0.15s ease;
  }
  body.reduce-motion .section.active {
    transform: translateY(0) translateZ(0);
  }
  body.reduce-motion .nav-indicator {
    transition: width 0.15s ease, height 0.15s ease;
  }
  body.reduce-motion .dock-indicator {
    transition: width 0.15s ease, height 0.15s ease, opacity 0.15s ease;
  }

  /* moderator identity bar */
  .moderator-bar{
    display:flex;
    align-items:center;
    gap:8px;
    margin-bottom:20px;
    padding:8px 12px;
    background:var(--panel);
    border:1px solid var(--border);
    border-radius:var(--radius-sm);
    font-family:var(--font-body);
    font-size:12px;
  }
  .moderator-bar-label{
    color:var(--muted-2);
  }
  .moderator-bar-name{
    color:var(--accent);
    font-weight:700;
  }
  .moderator-bar-change{
    margin-left:auto;
    background:transparent;
    border:1px solid var(--border);
    color:var(--muted);
    border-radius:var(--radius-sm);
    padding:5px 12px;
    font-family:var(--font-body);
    font-size:12px;
    font-weight:600;
    cursor:pointer;
    transition:color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.15s cubic-bezier(0.4,0,0.2,1);
  }
  .moderator-bar-change:hover{
    color:var(--accent);
    border-color:var(--accent);
    background:var(--accent-dim);
  }
  .moderator-bar-change:active{
    transform:scale(0.95);
  }

  /* moderator name modal + loading modal — fade+scale both in and out */
  .modal-overlay{
    display:flex;
    position:fixed;
    inset:0;
    background:rgba(6, 6, 8, 0.75);
    backdrop-filter:blur(3px);
    align-items:center;
    justify-content:center;
    z-index:1000;
    padding:20px;
    opacity:0;
    visibility:hidden;
    pointer-events:none;
    transition:opacity 0.25s ease, visibility 0.25s ease, backdrop-filter 0.25s ease;
  }
  .modal-overlay.open{
    opacity:1;
    visibility:visible;
    pointer-events:auto;
    backdrop-filter:blur(5px);
  }
  .modal-card{
    position:relative;
    border-radius:var(--radius-lg);
    padding:28px 26px;
    max-width:380px;
    width:100%;
    text-align:center;
    transform:translateY(10px) scale(0.96);
    opacity:0;
    transition:transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease;
  }
  .modal-close-btn{
    position:absolute;
    top:12px;
    right:12px;
    width:28px;
    height:28px;
    display:flex;
    align-items:center;
    justify-content:center;
    border:none;
    background:transparent;
    color:var(--muted);
    font-size:20px;
    line-height:1;
    cursor:pointer;
    border-radius:50%;
    transition:background 0.15s ease, color 0.15s ease;
  }
  .modal-close-btn:hover{
    background:var(--border);
    color:var(--text);
  }
  .modal-overlay.open .modal-card{
    transform:translateY(0) scale(1);
    opacity:1;
  }
  .loading-card{
    max-width:280px;
    padding:26px 24px;
    border-left:1px solid var(--border);
  }
  .spinner{
    width:34px;
    height:34px;
    margin:0 auto 16px;
    border:3px solid var(--border);
    border-top-color:var(--accent);
    border-radius:50%;
    animation:spin 0.7s linear infinite;
  }
  @keyframes spin{
    to{transform:rotate(360deg);}
  }
  .loading-card p{
    margin-bottom:0;
    font-family:var(--font-body);
    font-size:12px;
    color:var(--muted);
  }
  .modal-icon{
    color:var(--accent);
    display:flex;
    justify-content:center;
    margin-bottom:14px;
  }
  .modal-icon svg{
    width:32px;
    height:32px;
  }
  .modal-card h2{
    font-family:'Inter', sans-serif;
    font-size:18px;
    margin-bottom:8px;
  }
  .modal-card p{
    font-size:13px;
    color:var(--muted);
    line-height:1.5;
    margin-bottom:18px;
  }
  .modal-card input{
    width:100%;
    background:var(--bg);
    border:1px solid var(--border);
    border-radius:var(--radius-sm);
    padding:11px 14px;
    color:var(--text);
    font-family:var(--font-body);
    font-size:14px;
    margin-bottom:14px;
    outline:none;
    transition:border-color 0.2s ease, box-shadow 0.2s ease;
  }
  .modal-card input:focus{
    border-color:var(--accent);
    box-shadow:0 0 0 3px var(--accent-dim);
  }
  .modal-card input.input-invalid{
    border-color:var(--ban);
  }
  .modal-card input.input-invalid:focus{
    border-color:var(--ban);
    box-shadow:0 0 0 3px rgba(239,123,143,0.25);
  }
  .modal-platform-hint{
    font-size:11px;
    color:var(--muted-2);
    text-align:left;
    margin-bottom:8px;
    line-height:1.4;
  }
  .modal-platform-row{
    display:flex;
    gap:8px;
    margin-bottom:14px;
  }
  .modal-platform-btn{
    flex:1;
    padding:10px 12px;
    border:1px solid var(--border);
    border-radius:var(--radius-sm);
    background:var(--panel-2);
    color:var(--muted);
    font-family:var(--font-body);
    font-size:13px;
    font-weight:600;
    cursor:pointer;
    transition:border-color 0.2s ease, color 0.2s ease, background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  }
  .modal-platform-btn:hover{
    border-color:var(--muted);
    color:var(--text);
  }
  .modal-platform-btn:active{
    transform:scale(0.97);
  }
  .modal-platform-btn.selected{
    border-color:var(--accent);
    color:var(--accent);
    background:var(--accent-dim);
    box-shadow:0 0 0 3px var(--accent-dim);
  }
  .modal-submit{
    width:100%;
    background:linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    color:#12111a;
    border:none;
    border-radius:var(--radius-sm);
    padding:12px 16px;
    font-family:var(--font-body);
    font-size:14px;
    font-weight:600;
    letter-spacing:0.01em;
    cursor:pointer;
    box-shadow:0 4px 16px rgba(232, 180, 216, 0.25);
    transition:opacity 0.2s ease, transform 0.15s cubic-bezier(0.4,0,0.2,1), box-shadow 0.2s ease;
  }
  .modal-submit:disabled{
    opacity:0.4;
    cursor:not-allowed;
    box-shadow:none;
  }
  .modal-submit:not(:disabled):hover{
    opacity:0.92;
    box-shadow:0 6px 20px rgba(232, 180, 216, 0.35);
  }
  .modal-submit:not(:disabled):active{
    transform:scale(0.97);
  }
  .modal-submit.modal-submit-danger{
    background:var(--ban);
    box-shadow:0 4px 16px rgba(239, 123, 143, 0.25);
  }
  .modal-card .modal-submit + .modal-submit{
    margin-top:10px;
  }
  .modal-submit.modal-submit-ghost{
    background:transparent;
    box-shadow:none;
    color:var(--muted);
    border:1px solid var(--border);
  }
  .modal-submit.modal-submit-ghost:not(:disabled):hover{
    color:var(--text);
    border-color:var(--accent);
    box-shadow:none;
  }


  /* 2FA modal — status text + resend/cancel row */
  .tfa-status{
    font-family:var(--font-body);
    font-size:11px;
    color:var(--muted);
    min-height:14px;
    margin:-6px 0 14px;
    text-align:left;
  }
  .tfa-status.tfa-status-error{
    color:var(--ban);
  }
  .tfa-actions{
    display:flex;
    justify-content:space-between;
    gap:8px;
    margin-top:14px;
  }
  .tfa-link-btn{
    background:transparent;
    border:none;
    color:var(--muted);
    font-family:var(--font-body);
    font-size:12px;
    font-weight:500;
    cursor:pointer;
    padding:4px 2px;
    transition:color 0.2s ease;
  }
  .tfa-link-btn:hover:not(:disabled){
    color:var(--accent);
  }
  .tfa-link-btn:disabled{
    color:var(--muted-2);
    cursor:not-allowed;
  }
  #tfa-code-input{
    text-align:center;
    letter-spacing:0.3em;
    font-size:18px;
  }

  @media (max-width: 820px){
    /* Мобильная версия: сайдбар скрыт, навигация через докбар снизу */
    .sidebar{display:none;}
    body{flex-direction:column;}
    .main{margin-left:0; padding:32px 0 100px;}
    #about{padding-bottom:100px;}

    /* Секции на мобилках — в полную ширину с отступами от краёв */
    .section{
      max-width:100%;
      padding:24px 16px 100px;
    }

    /* modal responsive */
    .modal-overlay{padding:16px;}
    .modal-card{
      max-width:100%;
      width:100%;
      max-height:90dvh;
      overflow-y:auto;
      scrollbar-width:none;
      -ms-overflow-style:none;
      padding:22px 18px;
    }
    .modal-card::-webkit-scrollbar{display:none;}
  }

  @media (prefers-reduced-motion: reduce){
    *, *::before, *::after{
      animation-duration:0.01ms !important;
      animation-iteration-count:1 !important;
      transition-duration:0.01ms !important;
      scroll-behavior:auto !important;
    }
  }

  /* about page */
  .about-header{margin-bottom:18px;}
  .about-header h1{margin-bottom:6px;}
  .about-subtitle{
    font-family:var(--font-body);
    font-size:14px;
    color:var(--muted);
  }
  .about-desc{
    font-size:14px;
    color:var(--muted);
    line-height:1.65;
    margin-bottom:28px;
    max-width:64ch;
  }
  .about-sections{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:12px;
  }
  .about-link{
    display:flex;
    align-items:flex-start;
    gap:14px;
    padding:18px 20px;
    border-radius:var(--radius-md);
    text-decoration:none;
    color:var(--text);
    cursor:pointer;
    transition:transform 0.2s ease, border-color 0.2s ease;
  }
  .about-link:hover{
    transform:translateY(-2px);
    border-color:rgba(232,180,216,0.4);
  }
  .about-link:active{transform:scale(0.98);}
  .about-link-icon{
    width:9px;
    height:9px;
    border-radius:50%;
    margin-top:6px;
    background:var(--accent);
    box-shadow:0 0 8px var(--accent);
    flex-shrink:0;
  }
  .about-link strong{
    display:block;
    font-size:14px;
    margin-bottom:4px;
  }
  .about-link p{
    font-size:12.5px;
    color:var(--muted);
    line-height:1.4;
    margin:0;
  }

  /* Support section */
  .about-support{
    margin-top:32px;
  }
  .about-support h3{
    font-family:var(--font-display);
    font-size:18px;
    font-weight:500;
    margin-bottom:8px;
  }
  .about-support-desc{
    font-size:13px;
    color:var(--muted);
    line-height:1.5;
    margin-bottom:16px;
    max-width:64ch;
  }
  .support-links{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:12px;
  }
  .support-link{
    display:flex;
    align-items:center;
    gap:12px;
    padding:14px 16px;
    border-radius:var(--radius-md);
    text-decoration:none;
    color:var(--text);
    cursor:pointer;
    transition:transform 0.2s ease, border-color 0.2s ease;
  }
  .support-link:hover{
    transform:translateY(-2px);
    border-color:rgba(232,180,216,0.4);
  }
  .support-link:active{
    transform:scale(0.98);
  }
  .support-link svg{
    width:20px;
    height:20px;
    flex-shrink:0;
    color:var(--accent);
  }
  .support-link strong{
    display:block;
    font-size:14px;
    margin-bottom:2px;
  }
  .support-link span{
    font-size:12px;
    color:var(--muted);
  }
  .support-link-disabled{
    opacity:0.5;
    pointer-events:none;
  }
  .support-link-disabled svg{
    color:var(--muted-2);
  }

  @media (max-width: 520px){
    .about-sections{grid-template-columns:1fr;}
    .support-links{grid-template-columns:1fr;}
  }

  /* #about.animate-in убран: анимировал transform отдельно от общей
     слайд-системы секций (см. .section выше) — с fill-mode forwards он
     держал transform:translateY(0) навсегда, что конфликтовало с уездом
     секции за экран при уходе с вкладки (тот же баг "О сайте залипает",
     только в новой форме). Слайд между вкладками и так даёт входную
     анимацию #about наравне с остальными секциями — отдельный fade не нужен. */

  /* ---- Переключатель темы удалён — сайт теперь только тёмный,
     см. хендофф: светлую тему решили не поддерживать. ---- */


  #toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
  }
  .toast {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: var(--radius-pill);
    background: var(--panel);
    border: 1px solid var(--border);
    color: var(--text);
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    animation: toastIn 0.25s ease forwards;
    pointer-events: auto;
    max-width: 90vw;
    text-align: center;
  }
  .toast.toast-success {
    border-color: var(--ok-c);
    color: var(--ok-c);
  }
  .toast.toast-error {
    border-color: var(--ban);
    color: var(--ban);
  }
  .toast.toast-info {
    border-color: var(--accent);
    color: var(--accent);
  }
  .toast.toast-out {
    animation: toastOut 0.3s ease forwards;
  }
  @keyframes toastIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
  }
  @keyframes toastOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-8px); }
  }

/* Баннер для неавторизованных гостей — добавить в base.css.
   Заменяет старый #guest-stub. Через JS (mountGuestBanner в moderator.js)
   физически переносится внутрь текущей секции первым дочерним элементом —
   поэтому здесь НЕ позиционируем его абсолютно/sticky, он часть обычного
   потока контента и наследует отступы секции. */

.guest-banner {
  display: none;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  max-width: 560px;
  margin: 0 0 28px;
  padding: 14px 18px;
  border-radius: 12px;
  box-sizing: border-box;
  /* мягкий розовый в тон акцентному градиенту сайта (#e8b4d8),
     а не насыщенный фиолетовый — так разница цвета/фона мягче */
  background: rgba(232, 180, 216, 0.08);
  border: 1px solid rgba(232, 180, 216, 0.32);
  font-size: 13px;
  line-height: 1.5;
}

.guest-banner.visible {
  display: flex;
}

.guest-banner-title {
  font-weight: 700;
  color: #e8b4d8;
}

.guest-banner-text {
  color: var(--muted-2, #b8b8c8);
}

.guest-banner-btn {
  margin-top: 6px;
  align-self: flex-start;
  padding: 7px 16px;
  border: none;
  border-radius: 8px;
  background: #e8b4d8;
  color: #241626;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

/* Старый .guest-stub / .guest-stub-icon в base.css можно удалить —
   больше не используется нигде в разметке. */