/* base.css — токены, топбар, секции, модалки, формы, футер, адаптив. */

  /* Плоский минимализм. --glass-*/--panel-2/--role-* оставлены алиасами,
     пока остальные CSS-файлы не переведены — иначе сломаются var(). */
  @property --accent{
    syntax:'<color>';
    inherits:true;
    initial-value:#ffffff;
  }
  @property --accent-dim{
    syntax:'<color>';
    inherits:true;
    initial-value:rgba(255, 255, 255, 0.14);
  }
  @property --bg{
    syntax:'<color>';
    inherits:true;
    initial-value:#000000;
  }
  @property --panel{
    syntax:'<color>';
    inherits:true;
    initial-value:#000000;
  }
  @property --border{
    syntax:'<color>';
    inherits:true;
    initial-value:#262629;
  }
  @property --text{
    syntax:'<color>';
    inherits:true;
    initial-value:#ffffff;
  }
  @property --muted{
    syntax:'<color>';
    inherits:true;
    initial-value:#8a8a8f;
  }
  @property --muted-2{
    syntax:'<color>';
    inherits:true;
    initial-value:#55555c;
  }
  :root{
    /* --- цвета поверхностей / текста (сверено с home_demo_v4.html) --- */
    --bg: #000000;
    --panel: #000000;       /* плоский минимализм — панели/карточки не имеют отдельного фона от --bg, различие через --border */
    --border: #262629;
    --border-strong: #3a3a40;
    --text: #ffffff;
    --muted: #8a8a8f;
    --muted-2: #55555c;

    /* --- брендовый акцент --- */
    --accent: #ffffff;              /* минимализм — единственный акцент это сам белый текст/обводка, без цветного бренд-акцента */
    --accent-dim: rgba(255, 255, 255, 0.14);
    --accent-2: #ffffff;            /* алиас на --accent — вторичного акцента для градиентов в минимализме нет, см. --role-* ниже */

    /* --- .frosted / --glass-* — АЛИАСЫ на плоский стиль, не настоящее стекло.
       Оставлены как имена токенов, чтобы ещё не тронутый CSS (answers.css,
       admin.css, content.css, videos.css, feedback.css) не сломался —
       backdrop-filter эффективно отключается (blur(0)), карточки становятся
       плоскими панелями с 1px обводкой вместо стекла. Убрать эти алиасы
       можно только когда .frosted-классы будут выведены из использования
       во всех файлах в следующих кусках переноса. */
    --panel-2: #000000;
    --glass: transparent;
    --glass-border: var(--border-strong);
    --glass-blur: none;
    --glass-blur-fallback: none;
    --glass-shadow: none;
    --glass-highlight: none;

    /* --- семантические цвета: НЕ трогать под минимализм, несут функциональный смысл
       (имена -c сохранены как раньше: --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;         /* ок / онлайн / выполнено — единый зелёный статус-токен */
    --ok-dim: rgba(127, 224, 184, 0.16);

    /* --- роли и бейджики: отдельная категория от статус-семантики выше,
       не путать --role-* с --ban-c/--ok-c и т.п. Держат свой цвет даже в
       минимализме (различение ролей важнее единообразия бренд-акцента). --- */
    --role-admin: #8b7cf6;
    --role-admin-dim: rgba(139, 124, 246, 0.18);
    --role-senior: #e8b4d8;
    --role-senior-dim: rgba(232, 180, 216, 0.28);
    --role-mod: var(--del-c);
    --role-mod-dim: var(--del-dim);
    --role-supporter: #e8b4d8;
    --role-supporter-dim: rgba(232, 180, 216, 0.28);
    --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 ещё не тронуты в переносе
       и продолжают ссылаться на старые имена. */
    --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);

    /* --- шрифты (связка выбрана пользователем 21.09: Onest — всё,
       Unbounded — заголовки/бренд, Comfortaa — кнопки. Все трое с родной
       кириллицей — M PLUS 1p выкинут: у него кириллицы нет вообще, русский
       текст дорисовывался фолбэком и рвался на мелких кеглях) --- */
    --font-display: 'Unbounded', 'Onest', sans-serif;  /* заголовки h1, бренд, hero */
    --font-body: 'Onest', sans-serif;     /* тело текста, инпуты, UI — дефолт на body */
    --font-btn: 'Comfortaa', 'Onest', sans-serif;      /* кнопки/переключатели */
    --font-mono: 'Onest', sans-serif;     /* алиас на --font-body — моно выкинут полностью, токен оставлен только чтобы не ломать var(--font-mono) в ещё не тронутых CSS-файлах */

    /* --- радиусы: мягче/просторнее, чем терминал-стиль, но без glass-масштаба --- */
    --radius-lg: 20px;   /* крупные панели/модалки */
    --radius-md: 16px;   /* обычные карточки: rule-card, answer-card, chat-example, feedback-card, about-link, cmd-table */
    --radius-sm: 10px;   /* кнопки, инпуты, textarea, small controls */
    --radius-pill: 999px; /* пилюли: .tag, .chip, .verdict, .perm, .platform-badge, .profile-role — полное скругление, как в v4 (.version-pill/.user-chip) */

    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%;
    height:100dvh;
    display:flex;
    line-height:1.5;
    overflow-x:hidden;
    overflow-y:hidden;
    position:relative;
    -webkit-font-smoothing:antialiased;
    -moz-osx-font-smoothing:grayscale;
    text-rendering:optimizeLegibility;
    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);}

  /* .frosted — плоская панель с 1px обводкой (стекло отключено в токенах). */
  .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);
  }

  /* Некопируемый UI: кнопки, заголовки, меню, метки, иконки.
     Текст в инпутах и контенте выделяется как раньше. */
  button, h1, h2, h3,
  .topbar-nav, .mobile-menu, .site-footer,
  .label, .chat-switch, .proposal-mode-toggle,
  .feedback-stars, .toast, .lock-icon{
    user-select:none;
    -webkit-user-select:none;
    -moz-user-select:none;
  }
  /* Служебный текст (бейджи, теги, нав) не выделяется при копировании. */
  .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;
  }
  /* Профиль: ник/роль/бейджи тоже не выделяются. */
  #profile-nickname, #profile-role, #profile-platform-badge,
  .tfa-badge, .profile-section-title{
    user-select:none;
    -webkit-user-select:none;
    -moz-user-select:none;
  }

  /* TOPBAR: лого+пункты без фона, активный — цветом, чипа с фоном. */
  body{
    display:block;
  }
  .topbar{
    height:68px;
    display:grid;
    grid-template-columns:1fr auto 1fr;
    align-items:center;
    column-gap:16px;
    padding:0 40px 0 48px;
    position:relative;
    z-index:10;
  }
  .topbar-left{display:flex; align-items:center; gap:34px; grid-column:1; justify-self:start; min-width:0;}
  .topbar-nav{
    display:flex; align-items:center; gap:26px;
    grid-column:2; justify-self:center;
    position:static; transform:none;
    white-space:nowrap;
  }
  .brand{
    display:flex;
    align-items:center;
    text-decoration:none;
    color:var(--text);
    cursor:pointer;
    flex-shrink:0;
  }
  .brand svg{display:block; width:27px; height:32px;}
  .brand-text{
    font-family:var(--font-display);
    font-size:15px;
    font-weight:600;
    margin-left:8px;
    letter-spacing:0;
  }
  .topbar-right{display:flex; align-items:center; gap:10px; grid-column:3; justify-self:end; min-width:0;}
  .nav-indicator{display:none;} /* активный пункт — только цветом текста, без пилюли (см. .nav-item.active ниже) */
  .nav-item{
    position:relative;
    font-family:var(--font-body);
    font-size:13.5px;
    font-weight:500;
    color:#6e6e75;
    background:none;
    border:none;
    cursor:pointer;
    padding:0;
    transition:color 0.15s ease;
  }
  .nav-item:hover:not(.active){color:var(--text);}
  .nav-item.active{color:var(--text);}
  .user-chip{
    display:flex;
    align-items:center;
    gap:8px;
    padding:5px 6px 5px 14px;
    border-radius:var(--radius-pill);
    border:1px solid var(--border-strong);
    background:none;
    font:inherit;
    line-height:normal;
    cursor:pointer;
  }
  .user-chip .moderator-bar-name{
    font-size:12.5px;
    font-weight:600;
    max-width:140px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }
  .user-chip-avatar{
    width:26px;
    height:26px;
    border-radius:50%;
    background:#000;
    border:1.5px solid #fff;
    color:var(--muted);
    display:flex;
    align-items:center;
    justify-content:center;
    flex-shrink:0;
    overflow:hidden;
  }
  .user-chip-avatar svg{width:20px; height:20px;}
  .user-chip-avatar img{width:100%; height:100%; object-fit:cover; border-radius:50%; display:block;}
  #topbar-actions{display:flex;}
  .burger{
    display:none;
    width:36px; height:36px;
    border-radius:var(--radius-sm);
    border:1px solid var(--border-strong);
    background:none;
    align-items:center;
    justify-content:center;
    cursor:pointer;
  }
  .burger span, .burger span::before, .burger span::after{
    content:'';
    display:block;
    width:16px; height:1.5px;
    background:var(--text);
    position:relative;
  }
  .burger span::before{position:absolute; top:-5px;}
  .burger span::after{position:absolute; top:5px;}

  /* Мобильное меню — полноэкранный список, дизайн докрутится позже. */
  .mobile-menu{
    display:block;
    position:fixed;
    inset:0;
    z-index:100;
    background:rgba(0,0,0,.55);
    -webkit-backdrop-filter:blur(18px) saturate(1.2);
    backdrop-filter:blur(18px) saturate(1.2);
    padding:24px;
    overflow-y:auto;
    opacity:0;
    visibility:hidden;
    pointer-events:none;
    transition:opacity 0.22s ease, visibility 0.22s ease;
  }
  .mobile-menu::before{
    content:'';
    position:absolute;
    inset:0;
    pointer-events:none;
    opacity:.15;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  }
  .mobile-menu.open{opacity:1; visibility:visible; pointer-events:auto;}
  .mobile-menu-close{
    position:fixed;
    top:16px;
    right:16px;
    z-index:101;
    width:38px;
    height:38px;
    display:flex;
    align-items:center;
    justify-content:center;
    border-radius:50%;
    border:1px solid var(--border-strong);
    background:rgba(0,0,0,.6);
    color:var(--text);
    font-size:22px;
    line-height:1;
    cursor:pointer;
  }
  .mobile-menu .nav-item{
    display:block;
    width:100%;
    text-align:left;
    font-size:20px;
    padding:16px 4px;
    border-bottom:1px solid var(--border);
  }
  .mobile-menu .nav-item:last-child{border-bottom:none;}

  @media (max-width:1100px) and (min-width:821px){
    .topbar{padding:0 24px; column-gap:12px;}
    .topbar-nav{gap:18px;}
    .nav-item{font-size:13px;}
    .brand-text{font-size:15px;}
  }
  @media (max-width:820px){
    .topbar-nav{display:none;}
    .burger{display:flex; flex-shrink:0;}
    .topbar{padding:0 16px 0 20px; column-gap:10px; grid-template-columns:auto 1fr auto;}
    .topbar-left{grid-column:1;}
    .topbar-right{grid-column:3;}
    .brand-text{display:none;}
    .brand svg{width:28px; height:33px;}
    .user-chip{flex-shrink:0; padding:4px 5px 4px 12px;}
    .user-chip .moderator-bar-name{max-width:96px; font-size:12px;}
  }
  .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);}
  /* Бейдж платформы — только идентификатор, тему сайта не меняет. */
  .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;
  }
  /* Кросс-фейд подмены бейджа через opacity в JS. */
  #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: сам не скроллится (overflow:hidden) — скроллится каждая
     .section отдельно, иначе скролл течёт между вкладками. */
  .main{
    position:relative;
    z-index:1;
    height:calc(100vh - 68px);
    height:calc(100dvh - 68px);
    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:30px;
    font-weight:600;
    margin-bottom:10px;
    letter-spacing:0;
    line-height:1.25;
  }
  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;
  }
  /* Секции — поверх друг друга (absolute), видимая — fade+сдвиг снизу. */
  /* Скроллбар скрыт визуально, скролл колесом/тачем работает. */
  .section{
    position:absolute;
    inset:0;
    overflow-y:auto;
    scrollbar-width:none;
    -ms-overflow-style:none;
    max-width:900px;
    margin:0 auto;
    padding:48px 56px 100px;
    opacity:0;
    pointer-events:none;
    transform:translateY(12px) translateZ(0);
    transition:opacity 0.22s ease, transform 0.22s ease;
  }
  .section::-webkit-scrollbar{display:none;}
  .section.active{
    opacity:1;
    pointer-events:auto;
    transform:translateY(0) translateZ(0);
  }

  /* ---------- Pull-to-refresh (кастомный, для тач-экранов) ----------
     Нативный душится вложенными скроллерами секций — тянем сами:
     потянул вниз на нуле скролла — спиннер, дальше порога — reload. */
  .ptr-indicator{
    position:absolute;
    top:10px;
    left:50%;
    width:28px;
    height:28px;
    margin-left:-14px;
    border-radius:50%;
    border:3px solid var(--border-strong);
    border-top-color:var(--text);
    background:rgba(0,0,0,.6);
    opacity:0;
    transform:translateY(-48px);
    transition:transform 0.18s ease, opacity 0.18s ease;
    z-index:6;
    pointer-events:none;
  }
  .ptr-indicator.visible{opacity:1;}
  .ptr-indicator.loading{animation:spin 0.7s linear infinite;}
  .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:var(--font-display);
    font-weight:600;
    font-size:20px;
    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 {
    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 #fff;
    background: #000;
    flex-shrink: 0;
  }
  .profile-avatar-placeholder {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: #000;
    color: var(--muted);
    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;
    min-height: 26px;
  }
  .profile-info h1 {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 22px;
    margin-bottom: 0;
    min-height: 30px;
  }
  .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;
  }
  /* Текст кнопок профиля — явно, не отдаём на откуп наследованию. */
  .profile-actions .modal-submit span {
    color: var(--bg);
    white-space: nowrap;
    flex-shrink: 0;
  }
  .profile-actions .modal-submit-ghost span {
    color: var(--muted);
  }
  .profile-actions .modal-submit-danger span {
    color: var(--bg);
  }
  .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(0, 0, 0, 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(0, 0, 0, 0.75);
    backdrop-filter:blur(14px);
    -webkit-backdrop-filter:blur(14px);
    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;
  }
  .modal-overlay.open{
    opacity:1;
    visibility:visible;
    pointer-events:auto;
  }
  /* Зерно поверх затемнения (клики сквозь — pointer-events:none, закрытие
     ловит сам оверлей). Карточка позже в DOM — рисуется выше зерна. */
  .modal-overlay::before{
    content:'';
    position:absolute;
    inset:0;
    pointer-events:none;
    opacity:0;
    transition:opacity 0.25s ease;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  }
  .modal-overlay.open::before{
    opacity:.15;
  }
  .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:var(--font-display);
    font-weight:600;
    font-size:17px;
    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-card textarea{
    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;
    resize:vertical;
    overflow-wrap:anywhere;
    transition:border-color 0.2s ease, box-shadow 0.2s ease;
  }
  .modal-card textarea:focus{
    border-color:var(--accent);
    box-shadow:0 0 0 3px var(--accent-dim);
  }
  .modal-card textarea::placeholder{color:var(--muted-2);}
  .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:var(--accent);
    color:var(--bg);
    border:none;
    border-radius:var(--radius-sm);
    padding:12px 16px;
    font-family:var(--font-btn);
    font-size:14px;
    font-weight:700;
    letter-spacing:0.01em;
    cursor:pointer;
    box-shadow:none;
    transition:opacity 0.2s ease, transform 0.15s cubic-bezier(0.4,0,0.2,1);
  }
  .modal-submit:disabled{
    opacity:0.4;
    cursor:not-allowed;
    box-shadow:none;
  }
  .modal-submit:not(:disabled):hover{
    opacity:0.85;
  }
  .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);
    transition:opacity 0.2s ease, transform 0.15s cubic-bezier(0.4,0,0.2,1), color 0.2s ease, border-color 0.2s ease;
  }
  .modal-submit.modal-submit-ghost:not(:disabled):hover{
    color:var(--text);
    border-color:var(--accent);
    box-shadow:none;
  }


  /* Глазик пароля (обёртку ставит JS вокруг input[type=password] в модалках) */
  .pass-wrap{position:relative; margin-bottom:14px;}
  .modal-card .pass-wrap input{margin-bottom:0; padding-right:42px;}
  .pass-toggle{
    position:absolute;
    right:8px;
    top:50%;
    transform:translateY(-50%);
    width:28px;
    height:28px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:none;
    border:none;
    color:var(--muted-2);
    cursor:pointer;
    border-radius:50%;
    transition:color 0.15s ease;
  }
  .pass-toggle:hover{color:var(--text);}
  .pass-toggle svg{width:18px; height:18px; display:block;}

  .tfa-hint{
    font-size:12px;
    color:var(--muted);
    margin-top:12px;
    margin-bottom:0;
  }
  /* Забанен: контент целиком прячем (как ТО) — удаление модалки ничего не даст */
  body.banned .topbar,
  body.banned .main,
  body.banned .site-footer,
  body.banned .notice-bar{
    display: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:0;}

    /* Скролл документа вместо вложенных скроллеров — иначе стоковый
       pull-to-refresh браузера не пробивается. Топбар sticky, секции
       в обычном потоке (активная видна, остальные display:none). */
    html, body{height:auto; min-height:100dvh;}
    body{overflow-y:auto;}
    .main{position:static; height:auto; overflow:visible;}
    .topbar{
      position:sticky;
      top:0;
      background:rgba(0,0,0,.72);
      -webkit-backdrop-filter:blur(12px);
      backdrop-filter:blur(12px);
    }

    /* Секции на мобилках — в полную ширину с отступами от краёв */
    .section{
      position:static;
      max-width:100%;
      padding:24px 16px 100px;
      display:none;
      opacity:1;
      transform:none;
      pointer-events:auto;
      transition:none;
    }
    .section.active{
      display:block;
      animation:tabPanelIn 0.28s cubic-bezier(0.16,1,0.3,1);
    }

    /* 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:var(--border-strong);
  }
  .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:var(--border-strong);
  }
  .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);
  }

  /* Навигационные карточки на главной — тот же паттерн, что .about-link */
  .home-nav{margin-bottom:40px;}
  .home-nav-grid{
    display:grid;
    grid-template-columns:1fr 1fr 1fr;
    gap:12px;
  }
  @media (max-width: 520px){
    .about-sections{grid-template-columns:1fr;}
    .home-nav-grid{grid-template-columns:1fr;}
    .home-links-grid{grid-template-columns:1fr;}
    .support-links{grid-template-columns:1fr;}
  }

  /* ---------- Бегучка объявлений (только главная, над футером) ---------- */
  .notice-bar{
    position:fixed;
    left:0; right:0; bottom:34px;
    z-index:49;
    background:var(--ban-c);
    color:#1c0404;
    overflow:hidden;
    white-space:nowrap;
    opacity:0;
    visibility:hidden;
    transition:opacity 0.25s ease, visibility 0.25s ease;
  }
  .notice-bar.show{
    opacity:1;
    visibility:visible;
    animation:footerIn 0.4s ease both;
  }
  .notice-track{
    display:inline-block;
    padding:7px 0;
    font-size:12.5px;
    font-weight:700;
    animation:noticeMarquee 18s linear infinite;
  }
  .notice-track span{padding:0 48px;}
  @keyframes noticeMarquee{
    from{transform:translateX(0);}
    to{transform:translateX(-50%);}
  }

  /* ---------- Футер: копирайт + версия (версия живёт в БД, подставляет
     env.js из GET /config; см. routers/config.py) ---------- */
  .site-footer{
    position:fixed;
    left:0; right:0; bottom:0;
    z-index:50;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    height:34px;
    padding:0 40px;
    background:rgba(0,0,0,.85);
    backdrop-filter:blur(8px);
    -webkit-backdrop-filter:blur(8px);
    border-top:1px solid var(--border);
    font-size:11.5px;
    color:var(--muted-2);
    white-space:nowrap;
  }
  .site-footer-copy{
    overflow:hidden;
    text-overflow:ellipsis;
  }
  .site-footer-version{color:var(--muted); flex-shrink:0;}
  @media (max-width:820px){
    .site-footer{padding:0 16px; font-size:10.5px;}
  }

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

  /* Колесо: сцена + список */
  .wheel-wrap{
    display:grid;
    grid-template-columns:1fr 280px;
    gap:20px;
    align-items:start;
    margin-bottom:24px;
  }
  .wheel-stage{
    display:flex;
    flex-direction:column;
    align-items:center;
    position:relative;
  }
  .wheel-pointer{
    width:0; height:0;
    border-left:10px solid transparent;
    border-right:10px solid transparent;
    border-top:16px solid var(--text);
    margin-bottom:-6px;
    z-index:1;
  }
  #wheel-canvas{
    width:100%;
    max-width:340px;
    height:auto;
  }
  .wheel-stage .proposal-submit{margin-top:16px;}
  .wheel-winner{
    margin-top:12px;
    font-family:var(--font-display);
    font-size:16px;
    font-weight:600;
    min-height:1.4em;
    text-align:center;
  }
  .wheel-winner-name{
    font-family:var(--font-display);
    font-size:24px;
    font-weight:600;
    margin-bottom:6px;
  }
  .wheel-status{
    text-align:center;
    font-size:12.5px;
    font-weight:600;
    margin:-12px 0 20px;
    min-height:1.4em;
  }
  .wheel-status.off{color:var(--ban-c);}
  .wheel-status.on{color:var(--ok-c);}
  @media (max-width:600px){
    .wheel-wrap{grid-template-columns:1fr;}
  }

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


  #toast-container {
    position: fixed;
    bottom: 48px;
    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: var(--radius-sm);
  box-sizing: border-box;
  background: var(--accent-dim);
  border: 1px solid var(--border-strong);
  font-size: 13px;
  line-height: 1.5;
}

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

.guest-banner-title {
  font-weight: 700;
  color: var(--text);
}

.guest-banner-text {
  color: var(--muted);
}

.guest-banner-btn {
  margin-top: 6px;
  align-self: flex-start;
  padding: 7px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

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

/* Главная. */
.home-hero{
  margin-bottom:40px;
  text-align:center;
}
.greeting{
  font-family:var(--font-display);
  font-size:28px;
  font-weight:600;
  letter-spacing:0;
  line-height:1.25;
  margin-bottom:0;
  color:var(--text);
  text-align:center;
}
.label{
  font-family:var(--font-body);
  font-size:11px;
  color:var(--muted-2);
  text-transform:uppercase;
  letter-spacing:0.06em;
  margin-bottom:12px;
}
.about-block{
  border-radius:var(--radius-md);
  padding:20px 22px;
  margin-bottom:32px;
}
.about-block p{
  font-size:13.5px;
  color:var(--muted);
  line-height:1.7;
}
.home-links{
  margin-bottom:40px;
}
.home-links-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}
.home-link{
  display:flex;
  align-items:center;
  gap:12px;
  font-family:var(--font-body);
  font-size:13.5px;
  font-weight:600;
  color:var(--text);
  text-decoration:none;
  border-radius:var(--radius-md);
  padding:14px 16px;
  transition:transform 0.2s ease, border-color 0.2s ease;
}
.home-link svg{
  width:18px;
  height:18px;
  flex-shrink:0;
  display:block;
}
.home-link-cur{
  width:18px;
  height:18px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:15px;
  font-weight:700;
  flex-shrink:0;
}
.home-link::after{
  content:'↗';
  margin-left:auto;
  color:var(--muted-2);
  font-size:13px;
  flex-shrink:0;
  transition:color 0.15s ease;
}
.home-link:hover{
  transform:translateY(-2px);
  border-color:var(--text);
}
.home-link:hover::after{color:var(--text);}
.home-link:active{transform:scale(0.98);}
.version-block{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:10px;
  padding-top:24px;
  border-top:1px solid var(--border);
}
.version-pill{
  display:inline-flex;
  align-items:center;
  font-family:var(--font-body);
  font-size:11.5px;
  font-weight:600;
  color:var(--muted);
  border:1px solid var(--border-strong);
  padding:6px 14px;
  border-radius:var(--radius-pill);
}
.patchnote{
  color:var(--muted-2);
  font-size:12.5px;
  max-width:480px;
}

  /* ---------- Входная анимация первой загрузки ---------- */
  @keyframes topbarIn{
    from{opacity:0; transform:translateY(-14px);}
    to{opacity:1; transform:none;}
  }
  @keyframes mainIn{
    from{opacity:0;}
    to{opacity:1;}
  }
  @keyframes footerIn{
    from{opacity:0; transform:translateY(10px);}
    to{opacity:1; transform:none;}
  }
  .topbar{animation:topbarIn 0.45s cubic-bezier(0.16,1,0.3,1) both;}
  .main{animation:mainIn 0.4s ease 0.08s both;}
  .site-footer{animation:footerIn 0.4s ease 0.15s both;}

/* Чат: заголовок/свитч по центру, строки — тонкая обводка без заливки. */
.chat-title{
  text-align:center;
  margin-bottom:8px;
}
.chat-subtitle{
  text-align:center;
  margin:0 auto 28px;
  min-height:1.4em; /* держит высоту даже когда пользователь ещё не вписал текст */
}
.chat-switch{
  position:relative;
  display:flex;
  justify-content:center;
  width:fit-content;
  margin:0 auto 32px;
  border:1px solid var(--border-strong);
  border-radius:var(--radius-pill);
  padding:4px;
  gap:2px;
}
/* Скользящая пилюля — едет за активной кнопкой (позицию ставит nav.js) */
.switch-indicator{
  position:absolute;
  top:4px;
  left:0;
  height:calc(100% - 8px);
  width:0;
  border-radius:var(--radius-pill);
  background:var(--text);
  transition:transform 0.28s cubic-bezier(0.16,1,0.3,1), width 0.28s cubic-bezier(0.16,1,0.3,1);
  z-index:0;
}
.chat-switch-btn{
  position:relative;
  z-index:1;
  font-family:var(--font-btn);
  font-size:13.5px;
  font-weight:600;
  padding:8px 22px;
  border-radius:var(--radius-pill);
  border:none;
  background:none;
  color:var(--muted);
  cursor:pointer;
  transition:color 0.2s ease;
  white-space:nowrap;
}
.chat-switch-btn.active{
  background:none;
  color:var(--bg);
}
.chat-switch-btn:hover:not(.active){color:var(--text);}

.chat-tab-panel{display:none;}
.chat-tab-panel.active{
  display:block;
  animation:tabPanelIn 0.28s cubic-bezier(0.16,1,0.3,1);
}
/* Виды модерского свитча (форма/список) переключаются инлайном из JS —
   смена display перезапускает анимацию так же */
.proposal-form-wrap[data-proposal-view],
.proposal-list-wrap[data-proposal-view]{
  animation:tabPanelIn 0.28s cubic-bezier(0.16,1,0.3,1);
}
@keyframes tabPanelIn{
  from{opacity:0; transform:translateY(10px);}
  to{opacity:1; transform:none;}
}

.rule-row{
  border:1px solid var(--border-strong);
  border-radius:var(--radius-md);
  padding:18px 20px;
  margin-bottom:12px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:24px;
}
.rule-what{
  font-size:14px;
  color:var(--text);
}
.rule-consequence{
  font-size:13px;
  color:var(--muted);
  text-align:right;
  flex-shrink:0;
  max-width:240px;
}

.cmd-row-new{
  border:1px solid var(--border-strong);
  border-radius:var(--radius-md);
  padding:16px 20px;
  margin-bottom:10px;
  display:flex;
  align-items:center;
  gap:16px;
  flex-wrap:wrap;
}
.cmd-name-new{
  font-weight:600;
  font-size:14px;
  color:var(--text);
  flex-shrink:0;
}
.cmd-desc-new{
  color:var(--muted);
  font-size:13px;
  flex:1;
  min-width:200px;
}
.cmd-alt{
  color:var(--muted-2);
  font-size:12px;
  margin-left:6px;
}
.cmd-perm{
  display:inline-flex;
  align-items:center;
  font-family:var(--font-body);
  font-size:10.5px;
  font-weight:600;
  color:var(--muted);
  border:1px solid var(--border-strong);
  border-radius:var(--radius-pill);
  padding:2px 9px;
  white-space:nowrap;
}
/* Платформенный флаг — универсальный, не захардкожен под YouTube:
   data-platform="youtube"/"twitch" только для потенциальной будущей
   иконки/цвета, текст всегда берётся из самого содержимого span
   (редактируется в контент-эдиторе как обычный текст). */
.cmd-platform{
  display:inline-flex;
  align-items:center;
  font-family:var(--font-body);
  font-size:10.5px;
  font-weight:600;
  color:var(--muted);
  border:1px solid var(--border-strong);
  border-radius:var(--radius-pill);
  padding:2px 9px;
  white-space:nowrap;
}
.cmd-badges{
  display:flex;
  align-items:center;
  gap:6px;
  flex-shrink:0;
}

@media (max-width:760px){
  .rule-row{flex-direction:column; align-items:flex-start; gap:8px;}
  .rule-consequence{text-align:left; max-width:100%;}
  .cmd-row-new{flex-direction:column; align-items:flex-start;}
}

/* Предложка: форма (зритель) или список на модерацию (тогл у старших). */
.proposal-top-row{
  display:flex;
  align-items:center;
  gap:28px;
  margin-bottom:32px;
  max-width:640px;
  margin-left:auto;
  margin-right:auto;
}
/* По умолчанию (нет доступа к модерации) — единственный свитч Команды/Видео
   центрирован по странице, как в "Чате". */
.proposal-top-row .chat-switch{
  margin:0 auto;
}
/* Есть доступ к модерации (#proposal-mode-toggle показан) — свитчи
   держатся компактной группой по центру (растяжка space-between и
   position:absolute пробовались 12.09 — разъезжались/накладывались). */
.proposal-top-row.has-mode-toggle{
  justify-content:center;
}
.proposal-top-row.has-mode-toggle .chat-switch{
  margin:0 auto;
}
.proposal-mode-toggle{
  display:none; /* включается через JS (moderator.js updateProposalAccess) только у кого есть право claims */
  position:relative;
  align-items:center;
  border:1px solid var(--border);
  border-radius:var(--radius-pill);
  padding:3px;
  gap:2px;
  flex-shrink:0;
}
.proposal-mode-toggle .switch-indicator{
  top:3px;
  height:calc(100% - 6px);
}
.proposal-mode-btn{
  position:relative;
  z-index:1;
  font-family:var(--font-btn);
  font-size:12px;
  font-weight:600;
  padding:5px 12px;
  border-radius:var(--radius-pill);
  border:none;
  background:none;
  color:var(--muted-2);
  cursor:pointer;
  transition:color 0.2s ease;
  white-space:nowrap;
}
.proposal-mode-btn.active{background:none; color:var(--bg);}
.proposal-mode-btn:hover:not(.active){color:var(--text);}

/* Отзыв — та же схема, что предложка: без внешней карточки, кнопка по центру */
#feedback-form-wrap{
  display:flex;
  flex-direction:column;
  gap:20px;
  max-width:520px;
  margin:0 auto;
}
#feedback-form-wrap .field{margin-bottom:0;}
#feedback-form-wrap .field textarea{resize:none;}
#feedback-form-wrap .field textarea:focus{
  outline:none;
  border-color:var(--text);
}
#feedback-form-wrap .feedback-status{margin:0;}
#feedback-form-wrap .proposal-submit{margin-top:0;}

/* Лейблы полей — по центру, в стиле меток сайта */
#feedback-form-wrap .field > label,
.proposal-form-wrap .field > label{
  display:block;
  text-align:center;
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:0.06em;
  color:var(--muted);
  margin-bottom:10px;
}

/* Предложка: свитчи в столбик (главный крупно, модераторский тише),
   поля без внешних карточек, кнопка по центру */
.proposal-top-row{
  flex-direction:column;
  gap:12px;
}
.proposal-mode-toggle{opacity:.85;}
.proposal-mode-toggle .proposal-mode-btn{
  font-size:11.5px;
  padding:4px 11px;
}
.proposal-form-wrap{
  display:flex;
  flex-direction:column;
  gap:12px;
  max-width:520px;
  margin:0 auto;
}
.proposal-form-wrap .form-card{
  margin:0;
  max-width:none;
}
.proposal-form-wrap .field{margin-bottom:0;}
/* Рамка на самом поле, фокус подсвечивает его же */
.proposal-form-wrap .field textarea{resize:none;}
.proposal-form-wrap .field input:focus,
.proposal-form-wrap .field textarea:focus{
  outline:none;
  border-color:var(--text);
}
.proposal-submit{
  align-self:center;
  margin-top:6px;
  padding-left:38px;
  padding-right:38px;
}

.form-card{
  max-width:520px;
  margin:0 auto;
  border:1px solid var(--border);
  border-radius:var(--radius-md);
  padding:22px 20px;
}
.field{margin-bottom:20px;}
.field:last-of-type{margin-bottom:24px;}
.field label{
  display:block;
  font-size:12px;
  color:var(--muted);
  margin-bottom:6px;
}
.field input, .field textarea{
  width:100%;
  background:transparent;
  border:1px solid var(--border-strong);
  border-radius:var(--radius-sm);
  padding:10px 12px;
  color:var(--text);
  font-family:var(--font-body);
  font-size:14px;
  resize:vertical;
}
.field input::placeholder, .field textarea::placeholder{color:var(--muted-2);}
.field textarea{overflow-wrap:anywhere;}
.submit-btn{
  background:var(--text);
  color:var(--bg);
  border:none;
  border-radius:var(--radius-pill);
  padding:10px 24px;
  font-family:var(--font-btn);
  font-size:14px;
  font-weight:700;
  cursor:pointer;
  transition:opacity 0.15s ease;
}
.submit-btn:disabled{opacity:0.6; cursor:default;}
.submit-btn:not(:disabled):hover{opacity:0.85;}

.lock-card{
  border-radius:var(--radius-md);
  padding:48px 24px;
  text-align:center;
  max-width:400px;
  margin:0 auto;
}
.lock-icon{margin-bottom:16px; opacity:0.6; display:flex; justify-content:center;}
.lock-icon svg{width:32px; height:32px;}
.lock-title{font-size:16px; font-weight:600; margin-bottom:8px;}
.lock-text{font-size:13px; color:var(--muted); margin-bottom:20px;}

@media (max-width:600px){
  .proposal-top-row{flex-direction:column; gap:16px;}
  .proposal-top-row.has-mode-toggle{justify-content:center;}
  .proposal-top-row .chat-switch,
  .proposal-top-row.has-mode-toggle .chat-switch{margin:0 auto;}
}

/* Поповер пилюли: десктоп — дропдаун, мобилка — фулскрин с крестиком. */
.user-popover-overlay{
  display:block;
  position:fixed;
  inset:0;
  z-index:200;
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  background:rgba(0,0,0,.55);
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
  transition:opacity 0.22s ease, visibility 0.22s ease;
}
.user-popover-overlay.open{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
}
.user-popover-overlay::before{
  content:'';
  position:absolute;
  inset:0;
  pointer-events:none;
  opacity:0;
  transition:opacity 0.22s ease;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}
.user-popover-overlay.open::before{
  opacity:.15;
}
.user-popover{
  position:absolute;
  top:80px;
  right:40px;
  width:340px;
  max-height:calc(100vh - 100px);
  overflow-y:auto;
  border-radius:var(--radius-lg);
  padding:20px;
  background:#0b0b0e;
  border:1px solid var(--border-strong);
  box-shadow:0 16px 48px rgba(0,0,0,.65);
  transform:translateY(-10px) scale(0.98);
  opacity:0;
  transition:transform 0.25s cubic-bezier(0.16,1,0.3,1), opacity 0.2s ease;
}
.user-popover-overlay.open .user-popover{
  transform:none;
  opacity:1;
}
/* .profile-card рассчитан на полную вкладку (max-width:480px) — внутри
   узкого поповера ужимаем, иначе вылезает за скруглённые края */
.user-popover .profile-card{max-width:100%;}
.user-popover .profile-header{gap:14px; margin-bottom:18px;}
.user-popover .profile-avatar{width:56px; height:56px;}
.user-popover .profile-actions{flex-wrap:wrap;}
.user-popover .profile-actions .modal-submit{flex:1 1 130px;}
.user-popover-close{
  display:none; /* только на мобилке, см. media-запрос ниже */
}

@media (max-width:820px){
  .user-popover-overlay.open{
    background:var(--bg);
  }
  .user-popover{
    position:fixed;
    inset:0;
    top:0; right:0; bottom:0; left:0;
    width:100%;
    max-height:100dvh;
    height:100dvh;
    border-radius:0;
    border:none;
    padding:24px 20px 40px;
  }
  .user-popover-close{
    display:flex;
    align-items:center;
    justify-content:center;
    position:sticky;
    top:0;
    margin-left:auto;
    width:36px; height:36px;
    border-radius:50%;
    border:1px solid var(--border-strong);
    background:var(--bg);
    color:var(--text);
    font-size:20px;
    line-height:1;
    cursor:pointer;
    z-index:1;
  }
}