/* SHUSHU («ШуШу» — Только между нами)
   Нормативная визуальная система: минималистичный нео-брутализм (UI-01, UI-02, UI-03, ТЗ v3.0) */

:root {
    --ink: #000000;
    --ink-soft: #111111;
    --paper: #FFFFFF;
    --bg-page: #FFFDF6;
    --yellow: #FFE500;
    --yellow-ref: #FEE62E;
    --purple: #BD90F9;
    --purple-light: #EDE9FE;
    --blue-panel: #0186FD;
    --pink-panel: #F87BBF;
    --pink-pill: #FB75BA;
    --cyan-accent: #18E2C5;
    --blue-soft: #E9F3FD;
    --reply-bg: #DCEFFD;
    --green-ok: #269640;
    --border-thin: 2px solid #000000;
    --border-thick: 3px solid #000000;
    --border-heavy: 4px solid #000000;
    --shadow-hard: 4px 4px 0px #111111;
    --shadow-sm: 2px 2px 0px #111111;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html,
body {
    overflow-x: hidden;
}

body {
    margin: 0;
    padding: 16px;
    background-color: var(--bg-page);
    color: var(--ink);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.35;
}

body.in-room {
    padding: 0;
    background-color: var(--paper);
}

.app-frame {
    max-width: 1320px;
    margin: 0 auto;
    border: var(--border-heavy);
    border-radius: 0;
    background-color: var(--paper);
    box-shadow: 6px 6px 0px var(--ink-soft);
    position: relative;
}

body.in-room .app-frame {
    max-width: 100%;
    width: 100%;
    min-height: 100vh;
    border: 5px solid #000000;
    box-shadow: none;
    display: flex;
    flex-direction: column;
}

@media (min-width: 961px) {
    body.in-room {
        height: 100vh;
        overflow: hidden;
    }

    body.in-room .app-frame {
        height: 100vh;
        overflow: hidden;
    }
}

/* ==========================================================================
   1. ВЕРХНЯЯ ПАНЕЛЬ (HEADER — UI-01 / UI-02 / UI-03)
   ========================================================================== */
.top-brand-bar {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 0;
    min-height: 56px;
    height: 56px;
    padding: 0;
    background-color: var(--yellow-ref);
    border-bottom: 4px solid #000000;
    border-radius: 0;
    flex-shrink: 0;
}

.top-brand-left {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 24px;
    background-color: var(--yellow-ref);
    min-width: 0;
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background-color: transparent;
    color: #000000;
    border: none;
    border-radius: 0;
    font-size: 2.05rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 1;
    user-select: none;
}

.brand-cube-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    flex-shrink: 0;
}

.brand-cube-svg {
    display: block;
    width: 64px;
    height: 44px;
}

.top-brand-right {
    width: 228px;
    flex: 0 0 228px;
    background-color: var(--blue-panel);
    border-left: 3px solid #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 10px;
}

.top-square-btn,
.lang-toggle-btn {
    width: 46px;
    height: 46px;
    min-width: 46px;
    min-height: 46px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--paper);
    color: #000000;
    border: 2px solid #000000;
    border-radius: 0;
    box-shadow: none;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 900;
    letter-spacing: 0.01em;
    line-height: 1;
    text-align: center;
    user-select: none;
    cursor: pointer;
    transition: transform 0.08s ease, background-color 0.1s ease;
}

.top-brand-right .top-square-btn,
.top-brand-right .lang-toggle-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
}

body.in-room .top-brand-right .top-square-btn,
body.in-room .top-brand-right .lang-toggle-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    font-size: 0.82rem;
}

#btn-top-help {
    font-size: 1.25rem;
    font-weight: 900;
}

.top-square-btn:hover,
.lang-toggle-btn:hover {
    background-color: var(--bg-page);
}

.top-square-btn:active,
.lang-toggle-btn:active {
    transform: translate(1px, 1px);
}

.top-square-btn:focus-visible,
.lang-toggle-btn:focus-visible,
.mode-tab:focus-visible,
.side-tab:focus-visible,
.tri-btn:focus-visible {
    outline: 3px dashed #000000;
    outline-offset: 2px;
}

/* Всплывающие панели справки (?) и настроек (⚙) */
.top-popover {
    position: absolute;
    top: 60px;
    right: 12px;
    z-index: 50;
    width: min(460px, calc(100vw - 24px));
    padding: 14px 16px;
    background-color: var(--paper);
    border: 3px solid #000000;
    box-shadow: var(--shadow-hard);
}

.top-popover__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid #000000;
    font-size: 0.96rem;
}

.top-popover__text {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.4;
}

/* ==========================================================================
   2. ИНФОРМАЦИОННАЯ ПАНЕЛЬ КОМНАТЫ И ПЕРЕКЛЮЧАТЕЛЬ «ЧАТ» / «ЛИСТ»
   ========================================================================== */
#room-active-shell {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.room-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 81px;
    min-height: 81px;
    padding: 6px 14px 6px 16px;
    border-bottom: 3px solid #000000;
    background-color: var(--paper);
    flex-shrink: 0;
}

.room-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1 1 auto;
}

.room-leave-btn {
    width: 64px;
    height: 64px;
    min-width: 64px;
    min-height: 64px;
    padding: 0;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #FB75BA;
    color: #000000;
    border: 3px solid #000000;
    border-radius: 0;
    box-shadow: 3px 3px 0 #000000;
    cursor: pointer;
    user-select: none;
    transition: transform 0.08s ease, box-shadow 0.08s ease, background-color 0.1s ease;
}

.room-leave-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 #000000;
}

.room-leave-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 #000000;
}

.room-leave-btn:focus-visible {
    outline: 3px dashed #000000;
    outline-offset: 2px;
}

.room-leave-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.room-leave-btn__svg {
    width: 38px;
    height: 38px;
    display: block;
    flex-shrink: 0;
    pointer-events: none;
}

.room-title-group {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.room-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    margin: 0 0 3px 0;
}

.room-title {
    margin: 0;
    font-size: 2.2rem;
    font-weight: 900;
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: #000000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.room-copy-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #FFFFFF;
    color: #000000;
    border: 2.5px solid #000000;
    border-radius: 0;
    box-shadow: 2px 2px 0 #000000;
    cursor: pointer;
    user-select: none;
    transition: transform 0.08s ease, background-color 0.1s ease;
}

.room-copy-btn:hover {
    background-color: var(--bg-page);
}

.room-copy-btn:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 #000000;
}

.room-copy-btn:focus-visible {
    outline: 3px dashed #000000;
    outline-offset: 2px;
}

.room-copy-btn__svg {
    width: 18px;
    height: 18px;
    display: block;
    pointer-events: none;
}

.room-copy-feedback {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 8px;
    flex-shrink: 0;
    background-color: var(--yellow);
    color: #000000;
    border: 2px solid #000000;
    border-radius: 0;
    box-shadow: 2px 2px 0 #000000;
    font-size: 0.78rem;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
}

.room-subtitle {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #111111;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.room-subtitle strong {
    font-weight: 800;
}

.room-subtitle-dot {
    margin: 0 3px;
    font-weight: 900;
}

.status-dot {
    display: inline-block;
    width: 11px;
    height: 11px;
    background-color: var(--green-ok);
    border: 2px solid #000000;
    border-radius: 50%;
    margin-right: 3px;
    flex-shrink: 0;
}

.mode-switcher {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.mode-tab {
    width: 192px;
    height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 3px solid #000000;
    border-radius: 3px;
    box-shadow: none;
    font-family: inherit;
    font-size: 1.42rem;
    font-weight: 900;
    color: #000000;
    cursor: pointer;
    transition: transform 0.08s ease;
}

.mode-tab:active {
    transform: translate(1px, 1px);
}

.mode-tab__svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

#mode-btn-chat {
    background-color: var(--yellow-ref);
}

#mode-btn-sheet {
    background-color: var(--purple);
}

.mode-tab--active {
    box-shadow: inset 0 0 0 1px #000000;
}

/* ==========================================================================
   3. ОСНОВНАЯ СЕТКА КОМНАТЫ (ЛЕВАЯ КОЛОНКА ЧАТА + ПРАВАЯ ПАНЕЛЬ ТЕГОВ)
   ========================================================================== */
.workspace-grid--chat {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 245px;
    flex: 1;
    min-height: 0;
}

.workspace-grid--sheet {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.chat-stage {
    display: flex;
    flex-direction: column;
    border-right: 4px solid #000000;
    background-color: #FFFFFF;
    min-height: 0;
    overflow: hidden;
}

/* ==========================================================================
   4. ПАНЕЛЬ ПОИСКА И ФИЛЬТРОВ СООБЩЕНИЙ
   ========================================================================== */
.filter-bar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 56px;
    min-height: 56px;
    padding: 7px 16px;
    border-bottom: 2px solid #000000;
    background-color: var(--paper);
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.search-form {
    flex: 1 1 320px;
    height: 38px;
    padding: 0 10px;
    border: 2px solid #000000;
    background-color: var(--blue-soft);
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.search-form__svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
}

.search-form__input {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: none;
    background: transparent;
    color: #000000;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.84rem;
    outline: none;
}

.search-form__input::placeholder {
    color: #6B7280;
    font-weight: 500;
}

.filter-pills {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
}

.filter-pill {
    height: 38px;
    padding: 0 11px;
    border: 2px solid #000000;
    background-color: var(--paper);
    color: #000000;
    font-family: inherit;
    font-weight: 800;
    font-size: 0.82rem;
    box-shadow: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
}

.filter-pill--active {
    background-color: var(--pink-pill);
}

.filter-date-chevron {
    width: 12px;
    height: 12px;
    display: block;
}

.date-filter-popover {
    position: absolute;
    top: 54px;
    right: 18px;
    z-index: 30;
    padding: 10px 12px;
    background-color: var(--paper);
    border: 2px solid #000000;
    box-shadow: var(--shadow-hard);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.date-popover-label {
    font-size: 0.8rem;
    font-weight: 800;
}

.search-form__date {
    padding: 4px 8px;
    border: 2px solid #000000;
    background-color: var(--paper);
    color: #000000;
    font-weight: 700;
    font-size: 0.8rem;
}

.chat-context-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 18px;
    background-color: #FEF9C3;
    border-bottom: 2px solid #000000;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.chat-context-summary {
    font-weight: 800;
    font-size: 0.84rem;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.chat-context-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   5. ЛЕНТА И КАРТОЧКИ СООБЩЕНИЙ (.msg-card)
   ========================================================================== */
.feed-container {
    flex: 1 1 auto;
    min-height: 0;
    padding: 6px 16px;
    overflow-y: auto;
    scrollbar-width: none;
    display: flex;
    flex-direction: column;
    gap: 7px;
    background-color: #FFFFFF;
}

.feed-container::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.feed-pagination-bar {
    display: flex;
    justify-content: center;
    margin-bottom: 4px;
}

.chat-empty-state {
    margin: auto 0;
    padding: 24px 18px;
    border: 2px solid #000000;
    background-color: var(--paper);
    text-align: center;
}

.chat-empty-state p {
    margin: 6px 0 0;
    color: #4B5563;
    font-size: 0.88rem;
}

.chat-messages-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.msg-card {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr) 142px;
    gap: 0;
    padding: 0;
    background-color: var(--paper);
    border: 2px solid #000000;
    box-shadow: none;
    min-height: 76px;
    align-items: stretch;
}

.msg-card--highlighted {
    background-color: #FEF9C3;
}

/* Левый блок аватара на всю высоту карточки */
.msg-avatar {
    width: 80px;
    min-height: 100%;
    border: none;
    border-right: 2px solid #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 2px;
}

.msg-avatar--blue {
    background-color: #0188FE;
}

.msg-avatar--pink {
    background-color: #FE75BB;
}

.msg-avatar--teal {
    background-color: #00FAD6;
}

.msg-avatar--yellow {
    background-color: #FCE62E;
}

.msg-avatar--purple {
    background-color: #B781FB;
}

.msg-avatar__svg {
    width: 64px;
    height: 64px;
    display: block;
}

.msg-avatar--custom {
    background-color: #FFFFFF;
    padding: 0;
}

.msg-avatar__img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    display: block;
}

/* Центральная часть карточки сообщения */
.msg-body {
    padding: 4px 10px 5px 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}

.msg-meta {
    display: flex;
    align-items: baseline;
    gap: 7px;
    flex-wrap: wrap;
    margin-bottom: 1px;
    font-size: 0.85rem;
    line-height: 1.15;
}

.msg-seq {
    font-family: inherit;
    font-weight: 900;
    font-size: 0.85rem;
    color: #000000;
    padding: 0;
    border: none;
    background: transparent;
}

.msg-author {
    font-weight: 900;
    font-size: 0.86rem;
    color: #000000;
}

.msg-time {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6B7280;
    margin-left: 2px;
}

/* Контекстная плашка ответа внутри карточки */
.msg-parent-preview {
    margin: 1px 0 2px 0;
    padding: 1px 8px;
    border: none;
    background-color: var(--reply-bg);
    font-size: 0.75rem;
    line-height: 1.24;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    align-self: flex-start;
    max-width: 100%;
}

.msg-parent-preview__arrow {
    color: #4B5563;
    font-weight: 700;
}

.msg-parent-preview__divider {
    color: #93C5FD;
    font-weight: 700;
}

.msg-parent-preview__link {
    color: #1D4ED8;
    font-weight: 700;
}

.msg-parent-preview:hover {
    background-color: #BFDBFE;
}

.msg-text {
    margin: 0 0 3px 0;
    font-size: 0.84rem;
    font-weight: 500;
    line-height: 1.22;
    color: #000000;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.sr-only-inline-tags {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.msg-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
}

.tag-chip {
    height: 19px;
    padding: 0 9px;
    border: none;
    border-radius: 3px;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.74rem;
    color: #000000;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tag-chip--blue {
    background-color: #3898EC;
}

.tag-chip--purple {
    background-color: #B986FC;
}

.tag-chip--teal {
    background-color: #18E2C5;
}

.tag-chip--pink {
    background-color: #FB75BA;
}

.tag-chip--yellow {
    background-color: var(--yellow-ref);
}

.tag-chip--selected {
    outline: 2px solid #000000;
    font-weight: 900;
}

/* Правый блок кнопок карточки (.msg-actions) */
.msg-actions {
    padding: 5px 10px 5px 4px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    gap: 4px;
}

.tree-nav-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    width: 100%;
}

.tree-icon {
    width: 36px;
    height: 28px;
    min-width: 36px;
    padding: 0;
    border: 2px solid #000000;
    border-radius: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.85rem;
    background-color: #C7C7C7;
    color: #000000;
    opacity: 1;
    cursor: pointer;
    position: relative;
}

.tree-icon--active:not(:disabled) {
    background-color: #0186FD;
    color: #000000;
    opacity: 1;
    cursor: pointer;
}

.tree-icon--active:not(:disabled):hover {
    background-color: #2596FF;
}

.tree-icon--active:not(:disabled):active {
    transform: translate(1px, 1px);
}

.tree-icon:disabled,
.tree-icon--disabled {
    background-color: #C7C7C7;
    color: #000000;
    opacity: 1;
    cursor: default;
}

.tree-icon__count {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    background-color: var(--yellow-ref);
    border: 1.5px solid #000000;
    font-size: 0.65rem;
    font-weight: 900;
    line-height: 12px;
    text-align: center;
}

.reply-badge {
    width: 110px;
    height: 26px;
    padding: 0 8px;
    background-color: var(--yellow-ref);
    border: 2px solid #000000;
    border-radius: 3px;
    box-shadow: none;
    font-family: inherit;
    font-weight: 800;
    font-size: 0.78rem;
    color: #000000;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.reply-badge:hover {
    background-color: #FFE500;
}

/* ==========================================================================
   6. НИЖНЯЯ ПАНЕЛЬ ВВОДА СООБЩЕНИЯ (COMPOSER)
   ========================================================================== */
.composer-bar-wrap {
    border-top: 3px solid #000000;
    background-color: var(--paper);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.reply-composer-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 5px 14px;
    background-color: var(--reply-bg);
    border-bottom: 2px solid #000000;
    font-size: 0.82rem;
}

.reply-composer-banner__info {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
    overflow: hidden;
}

.reply-composer-banner__excerpt {
    color: #374151;
    font-style: italic;
    max-width: 420px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.composer-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 50px;
    padding: 6px 14px;
    background-color: var(--paper);
}

.composer-attach {
    width: 46px;
    height: 36px;
    flex: 0 0 46px;
    padding: 0;
    border: 2px solid #000000;
    border-radius: 3px;
    background-color: var(--blue-panel);
    color: #000000;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.composer-input-box {
    flex: 1 1 auto;
    height: 36px;
    padding: 0 8px 0 12px;
    border: 2px solid #000000;
    border-radius: 3px;
    background-color: var(--blue-soft);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.composer-textarea {
    flex: 1 1 auto;
    min-width: 0;
    height: 24px;
    max-height: 32px;
    padding: 2px 0;
    border: none;
    background: transparent;
    color: #000000;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 20px;
    resize: none;
    outline: none;
    overflow-y: hidden;
}

.composer-textarea::placeholder {
    color: #6B7280;
    font-weight: 500;
}

.composer-emoji-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.composer-send {
    width: 132px;
    height: 36px;
    flex: 0 0 132px;
    padding: 0 12px;
    background-color: var(--pink-panel);
    border: 2px solid #000000;
    border-radius: 3px;
    box-shadow: none;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 900;
    color: #000000;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.composer-send:hover:not(:disabled) {
    background-color: var(--pink-pill);
}

/* ==========================================================================
   7. ПРАВАЯ ПАНЕЛЬ РЕЖИМА «ЧАТ» (ТЕГИ И ТЕМЫ / ФАЙЛЫ ССЫЛКИ)
   ========================================================================== */
.side-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.side-panel--blue {
    background-color: var(--blue-panel);
}

.side-panel--pink {
    background-color: var(--pink-panel);
}

.side-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 6px 6px 0 6px;
    border-bottom: 3px solid #000000;
    background-color: #000000;
    flex-shrink: 0;
}

.side-tab {
    height: 40px;
    padding: 0 6px;
    border: 2px solid #000000;
    border-bottom: none;
    border-radius: 3px 3px 0 0;
    font-family: inherit;
    font-weight: 900;
    font-size: 0.84rem;
    cursor: pointer;
    color: #000000;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.side-tab--blue {
    background-color: var(--blue-panel);
}

.side-tab--pink {
    background-color: var(--pink-panel);
}

.side-panel__body {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: none;
}

.side-panel__body::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.room-tags-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.side-item {
    width: 100%;
    height: 33px;
    min-height: 33px;
    padding: 0;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    align-items: stretch;
    background-color: var(--paper);
    border: 2px solid #000000;
    border-radius: 2px;
    box-shadow: none;
    font-family: inherit;
    font-weight: 800;
    font-size: 0.84rem;
    color: #000000;
    text-align: left;
    cursor: pointer;
}

.side-item--yellow {
    background-color: #FFE934;
}

.side-item--yellow .side-item__hash {
    background-color: #FFE934;
}

.side-item__hash {
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 2px solid #000000;
    font-weight: 900;
    font-size: 0.95rem;
    color: #000000;
}

.side-item__hash--blue {
    background-color: #29B6F6;
}

.side-item__hash--pink {
    background-color: #F48FB1;
}

.side-item__hash--teal {
    background-color: #1DE9B6;
}

.side-item__hash--purple {
    background-color: #B388FF;
}

.side-item__hash--yellow {
    background-color: #FFE934;
}

.side-item__name {
    padding: 0 10px;
    display: flex;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 800;
}

.side-item__count {
    padding: 0 10px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    font-weight: 900;
}

.side-item--tag-btn:hover {
    background-color: #FEF9C3;
}

.side-item--selected {
    background-color: #FFE934;
    outline: 2px solid #000000;
}

/* ==========================================================================
   8. РЕЖИМ «ЛИСТ» (КЛЕТЧАТОЕ ПОЛЕ НА ВСЮ ШИРИНУ + СТРОГО 3 КНОПКИ СЛОЁВ)
   ========================================================================== */
.sheet-stage {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 520px;
}

.sheet-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 16px;
    background-color: var(--purple-light);
    border-bottom: 3px solid #000000;
    flex-wrap: wrap;
}

.sheet-tools,
.sheet-pencil-options,
.sheet-coords-layer-group,
.sheet-goto,
.layer-tri-control {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tool-box,
.tri-btn,
.goto-btn {
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    background-color: var(--paper);
    border: 2px solid #000000;
    border-radius: 0;
    box-shadow: 2px 2px 0px #000000;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-weight: 900;
    font-size: 0.95rem;
    color: #000000;
    cursor: pointer;
    user-select: none;
}

.tool-box--icon {
    width: 38px;
    padding: 0;
}

.sheet-tool-svg {
    width: 20px;
    height: 20px;
    display: block;
    flex-shrink: 0;
    pointer-events: none;
}

.tool-box:hover:not(:disabled),
.tri-btn:hover:not(:disabled),
.goto-btn:hover:not(:disabled) {
    background-color: #FEF9C3;
}

.tool-box--active,
.tri-btn--center-active {
    background-color: var(--yellow);
    color: #000000;
}

.tool-box--active:hover:not(:disabled),
.tri-btn--center-active:hover:not(:disabled) {
    background-color: var(--yellow);
}

.sheet-color-swatch {
    font-size: 1.25rem;
    line-height: 1;
}

.sheet-width-btn {
    min-width: 48px;
    font-size: 0.85rem;
}

.sheet-coords-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.coords-readout {
    height: 38px;
    padding: 0 12px;
    background-color: var(--paper);
    border: 2px solid #000000;
    border-radius: 0;
    box-shadow: 2px 2px 0px #000000;
    font-family: inherit;
    font-weight: 900;
    font-size: 0.9rem;
    color: #000000;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.coords-readout:hover {
    background-color: #FEF9C3;
}

.sheet-goto-popover {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 40;
    background-color: var(--paper);
    border: 3px solid #000000;
    box-shadow: 4px 4px 0px #000000;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sheet-goto-popover[hidden] {
    display: none !important;
}

.sheet-goto-input {
    width: 82px;
    height: 34px;
    padding: 0 8px;
    border: 2px solid #000000;
    border-radius: 0;
    background-color: #FFFFFF;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 800;
    color: #000000;
}

.sheet-status-banner {
    margin: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    border-bottom: 3px solid #000000;
}

.sheet-canvas-grid {
    position: relative;
    flex: 1;
    min-height: 500px;
    padding: 0;
    background-color: var(--paper);
    background-image:
        linear-gradient(to right, #CBD5E1 1px, transparent 1px),
        linear-gradient(to bottom, #CBD5E1 1px, transparent 1px);
    background-size: 24px 24px;
    background-position: 0px 0px;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    outline: none;
}

.sheet-canvas-grid--hand {
    cursor: grab;
}

.sheet-canvas-grid--hand.sheet-canvas-grid--panning {
    cursor: grabbing;
}

.sheet-canvas-grid--pencil {
    cursor: crosshair;
}

.sheet-canvas-grid--eraser {
    cursor: pointer;
}

.sheet-canvas-grid--sticker {
    cursor: copy;
}

.sheet-canvas-surface {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
    z-index: 1;
}

.sheet-stickers-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 2;
}

.sticker-card {
    position: absolute;
    padding: 10px 12px;
    border: 3px solid #000000;
    box-shadow: 4px 4px 0px #000000;
    background-color: var(--yellow);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    pointer-events: auto;
    user-select: text;
}

.sticker-card--yellow {
    background-color: var(--yellow);
}

.sticker-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-weight: 900;
    font-size: 0.84rem;
    margin-bottom: 6px;
    border-bottom: 2px solid #000000;
    padding-bottom: 4px;
    user-select: none;
}

.sticker-card--own .sticker-card__header {
    cursor: move;
}

.sticker-card__author {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sticker-card__controls {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.sticker-ctrl-btn {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 2px solid #000000;
    border-radius: 0;
    background-color: #FFFFFF;
    color: #000000;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 900;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.sticker-ctrl-btn:hover {
    background-color: #FEF9C3;
}

.sticker-card__textarea {
    flex: 1;
    width: 100%;
    min-height: 60px;
    border: none;
    background: transparent;
    resize: none;
    padding: 0;
    margin: 0;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.32;
    color: #000000;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    outline: none;
}

.sticker-card__text {
    flex: 1;
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.32;
    color: #000000;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    overflow-y: auto;
}

/* ==========================================================================
   9. ГЛАВНАЯ СТРАНИЦА (UI-01 / UI-02) И ОБЩИЕ ЭЛЕМЕНТЫ ФОРМ
   ========================================================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.status-alert {
    margin: 8px 14px;
    padding: 8px 12px;
    border: 2px solid #000000;
    font-weight: 800;
    font-size: 0.86rem;
    background-color: var(--yellow);
    color: #000000;
}

.status-alert--error {
    background-color: #FCA5A5;
}

.status-alert--ok {
    background-color: #86EFAC;
}

.auth-gate-section {
    min-height: calc(100vh - 118px);
    padding: 36px 20px 52px;
    background-color: var(--bg-page);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.gate-center-stage {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.concept-phrase-wrap {
    width: 100%;
    min-height: 112px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.concept-phrase-btn {
    appearance: none;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 8px 12px;
    margin: 0;
    color: var(--ink-soft);
    font-family: inherit;
    font-size: clamp(1.42rem, 3.2vw, 2.3rem);
    font-weight: 900;
    line-height: 1.22;
    letter-spacing: -0.02em;
    text-align: center;
    cursor: pointer;
    user-select: none;
    transition: opacity 160ms ease, transform 160ms ease;
}

.concept-phrase-btn:hover {
    text-decoration: underline;
    text-decoration-thickness: 3px;
    text-underline-offset: 6px;
}

.concept-phrase-btn:focus-visible {
    outline: 3px dashed #000000;
    outline-offset: 4px;
}

.concept-phrase-btn.phrase-changing {
    opacity: 0.16;
    transform: translateY(-3px);
}

@media (prefers-reduced-motion: reduce) {
    .concept-phrase-btn {
        transition: none;
    }

    .concept-phrase-btn.phrase-changing {
        opacity: 1;
        transform: none;
    }
}

.unified-gate-form {
    width: 100%;
    max-width: 440px;
    padding: 26px 24px;
    background-color: var(--paper);
    border: var(--border-heavy);
    border-radius: 0;
    box-shadow: 6px 6px 0px var(--ink-soft);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.gate-step2-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.gate-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.gate-step2-title {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 900;
    color: var(--ink-soft);
    letter-spacing: -0.015em;
    line-height: 1.2;
}

.gate-back-btn {
    appearance: none;
    background: transparent;
    border: none;
    border-bottom: 2px solid #000000;
    border-radius: 0;
    padding: 2px 0;
    color: #000000;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 800;
    cursor: pointer;
}

.gate-back-btn:hover {
    background-color: var(--yellow);
}

.gate-random-btn {
    width: 42px;
    height: 42px;
    padding: 0;
    background-color: #FFFFFF;
    color: #000000;
    border: 2.5px solid #000000;
    border-radius: 0;
    box-shadow: 2px 2px 0px #000000;
    font-family: inherit;
    font-size: 0.96rem;
    font-weight: 800;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 80ms ease, box-shadow 80ms ease, background-color 80ms ease;
}

.gate-random-btn--text {
    width: auto;
    min-width: 88px;
    padding: 0 14px;
}

.gate-random-btn--icon {
    width: 42px;
    padding: 0;
}

.gate-random-btn:hover,
.gate-random-btn--active,
.gate-random-btn[aria-pressed="true"] {
    background-color: var(--yellow);
}

.gate-random-btn:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0px #000000;
}

.gate-random-btn:focus-visible {
    outline: 3px dashed #000000;
    outline-offset: 2px;
}

.gate-random-label {
    display: inline-block;
    white-space: nowrap;
    pointer-events: none;
}

.gate-random-icon {
    width: 22px;
    height: 22px;
    display: block;
    pointer-events: none;
}

.gate-random-label[hidden],
.gate-random-icon[hidden] {
    display: none !important;
}

.gate-field-wrap {
    width: 100%;
}

.gate-input {
    width: 100%;
    height: 54px;
    padding: 12px 16px;
    background-color: var(--paper);
    color: #000000;
    border: var(--border-thick);
    border-radius: 0;
    box-shadow: 3px 3px 0px var(--ink-soft);
    font-family: inherit;
    font-size: 1.04rem;
    font-weight: 700;
}

.gate-input::placeholder {
    color: #525252;
    font-weight: 600;
}

.gate-input--random-mode::placeholder {
    color: #111111;
    font-weight: 800;
}

.gate-input:focus-visible {
    outline: 3px dashed #000000;
    outline-offset: 2px;
    background-color: var(--bg-page);
}

.gate-password-box {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.gate-input--password {
    padding-right: 52px;
}

.gate-pw-toggle {
    position: absolute;
    right: 9px;
    width: 36px;
    height: 36px;
    padding: 0;
    background-color: var(--bg-page);
    color: #000000;
    border: 2px solid #000000;
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.gate-pw-toggle:hover,
.gate-pw-toggle[aria-pressed="true"] {
    background-color: var(--yellow);
}

.gate-pw-icon {
    width: 18px;
    height: 18px;
    display: block;
    pointer-events: none;
}

.gate-error-msg {
    padding: 10px 12px;
    background-color: #FEE2E2;
    color: #000000;
    border: var(--border-thick);
    border-radius: 0;
    box-shadow: var(--shadow-sm);
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.35;
}

.gate-continue-btn {
    width: 100%;
    min-height: 54px;
    padding: 14px 20px;
    font-size: 1.12rem;
    font-weight: 900;
    border-radius: 0;
    transition: transform 0.08s ease;
}

.gate-toast {
    padding: 8px 12px;
    background-color: var(--bg-page);
    color: #000000;
    border: 2px solid #000000;
    border-radius: 0;
    font-size: 0.88rem;
    font-weight: 800;
    text-align: center;
}

.brutal-btn {
    padding: 12px 18px;
    border: var(--border-heavy);
    border-radius: 0;
    box-shadow: var(--shadow-hard);
    background-color: var(--paper);
    color: #000000;
    font-weight: 900;
    font-size: 1rem;
    cursor: pointer;
}

.brutal-btn:disabled,
.composer-send:disabled,
.tri-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.brutal-btn--primary {
    background-color: var(--yellow);
}

.brutal-btn--danger {
    background-color: #FCA5A5;
}

.brutal-btn--sm {
    padding: 5px 10px;
    border: 2px solid #000000;
    border-radius: 0;
    box-shadow: var(--shadow-sm);
    font-size: 0.82rem;
}

/* ==========================================================================
   10. АДАПТИВНАЯ КОМПОНОВКА (ПЛАНШЕТЫ И МОБИЛЬНЫЕ ЭКРАНЫ 768px / 375px / 320px)
   ========================================================================== */
@media (max-width: 960px) {
    .workspace-grid--chat {
        grid-template-columns: 1fr;
    }

    .chat-stage {
        border-right: none;
        border-bottom: 3px solid #000000;
    }

    .room-header-bar {
        height: auto;
        padding: 10px 14px;
        flex-wrap: wrap;
    }

    .room-header-left {
        align-items: flex-start;
        gap: 12px;
        width: 100%;
    }

    .room-leave-btn {
        width: 56px;
        height: 56px;
        min-width: 56px;
        min-height: 56px;
    }

    .room-leave-btn__svg {
        width: 32px;
        height: 32px;
    }

    .room-title-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .room-title {
        font-size: 1.65rem;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .mode-tab {
        width: 136px;
        height: 46px;
        font-size: 1.15rem;
    }

    .filter-bar {
        height: auto;
        flex-wrap: wrap;
        padding: 8px 12px;
    }

    .filter-pills {
        flex-wrap: wrap;
    }
}

@media (max-width: 640px) {
    body {
        padding: 6px;
    }

    .top-brand-left {
        padding: 0 10px;
        gap: 6px;
    }

    .brand-logo {
        font-size: 1.4rem;
    }

    .brand-cube-wrap {
        display: none;
    }

    .top-brand-right {
        width: auto;
        flex: 0 0 auto;
        gap: 5px;
        padding: 0 5px;
    }

    .top-brand-right .top-square-btn,
    body.in-room .top-brand-right .top-square-btn,
    body.in-room .top-brand-right .lang-toggle-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        font-size: 0.78rem;
    }

    body:not(.in-room) .top-brand-right .lang-toggle-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    .msg-card {
        grid-template-columns: 60px minmax(0, 1fr);
    }

    .msg-avatar {
        width: 60px;
    }

    .msg-avatar__svg,
    .msg-avatar__img {
        width: 48px;
        height: 48px;
    }

    .msg-actions {
        grid-column: 1 / -1;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        border-top: 2px solid #000000;
        padding: 6px 8px;
    }

    .tree-nav-row {
        width: auto;
    }

    .composer-bar {
        height: auto;
        flex-wrap: wrap;
        padding: 8px;
    }

    .composer-send {
        width: 100%;
        flex: 1 1 100%;
    }
}

/* ==========================================================================
   11. РЕДАКТОР ПОЛЬЗОВАТЕЛЬСКИХ АВАТАРОК 100×100 (SHUSHU — AVATAR CREATOR)
   ========================================================================== */
.avatar-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 120;
    background-color: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    overflow-y: auto;
}

.avatar-modal-backdrop[hidden] {
    display: none !important;
}

.avatar-modal {
    position: relative;
    width: min(500px, calc(100vw - 16px));
    max-width: 100%;
    background-color: #FFFFFF;
    border: 4px solid #000000;
    border-radius: 0;
    box-shadow: 7px 7px 0 #000000;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.avatar-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 54px;
    padding: 8px 12px 8px 16px;
    background-color: var(--yellow-ref);
    border-bottom: 4px solid #000000;
}

.avatar-modal__title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 900;
    letter-spacing: 0.01em;
    color: #000000;
    text-transform: uppercase;
}

.avatar-modal__close {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    padding: 0;
    background-color: #FB75BA;
    color: #000000;
    border: 3px solid #000000;
    border-radius: 0;
    box-shadow: 2px 2px 0 #000000;
    font-family: inherit;
    font-size: 1.15rem;
    font-weight: 900;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.avatar-modal__close:hover {
    background-color: #F472B6;
}

.avatar-modal__close:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 #000000;
}

.avatar-modal__body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background-color: #FFFFFF;
}

.avatar-editor-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.avatar-editor-stage[hidden],
.avatar-number-stage[hidden],
.avatar-cooldown-stage[hidden],
.avatar-palette-popover[hidden] {
    display: none !important;
}

.avatar-editor-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 64px;
    gap: 14px;
    align-items: start;
}

.avatar-canvas-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.avatar-canvas-viewport {
    width: 100%;
    aspect-ratio: 1 / 1;
    max-width: 340px;
    max-height: 340px;
    border: 4px solid #000000;
    border-radius: 0;
    box-shadow: 4px 4px 0 #000000;
    background-color: #FFFFFF;
    overflow: auto;
    position: relative;
    touch-action: none;
    user-select: none;
}

.avatar-canvas {
    display: block;
    width: 100%;
    height: 100%;
    background-color: #FFFFFF;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    cursor: crosshair;
    touch-action: none;
}

.avatar-used-colors {
    min-height: 36px;
    max-width: 340px;
    padding: 4px;
    border: 3px solid #000000;
    background-color: var(--bg-page);
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
}

.avatar-color-swatch {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    padding: 0;
    border: 2px solid #000000;
    border-radius: 0;
    box-shadow: 2px 2px 0 #000000;
    cursor: pointer;
    flex-shrink: 0;
}

.avatar-color-swatch--active {
    outline: 2px solid #0186FD;
    outline-offset: 1px;
}

.avatar-tools-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.avatar-tool-btn {
    width: 58px;
    height: 58px;
    min-width: 58px;
    min-height: 58px;
    padding: 0;
    background-color: #FFFFFF;
    color: #000000;
    border: 3px solid #000000;
    border-radius: 0;
    box-shadow: 4px 4px 0 #000000;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-family: inherit;
    font-weight: 900;
    cursor: pointer;
    position: relative;
}

.avatar-tool-btn--active {
    background-color: var(--yellow-ref);
}

.avatar-tool-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 5px 5px 0 #000000;
}

.avatar-tool-btn:active {
    transform: translate(1px, 1px);
    box-shadow: 2px 2px 0 #000000;
}

.avatar-zoom-badge {
    font-size: 0.76rem;
    font-weight: 900;
    line-height: 1;
    color: #000000;
}

/* Компактное окно «Палитра» */
.avatar-palette-popover {
    position: absolute;
    top: 0;
    right: 74px;
    z-index: 30;
    width: 236px;
    max-width: calc(100% - 8px);
    padding: 12px;
    background-color: #FFFFFF;
    border: 4px solid #000000;
    border-radius: 0;
    box-shadow: 6px 6px 0 #000000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.avatar-palette__top {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 6px;
    border-bottom: 3px solid #000000;
}

.avatar-palette__title {
    font-size: 1rem;
    font-weight: 900;
    text-transform: uppercase;
}

.avatar-palette__shape-wrap {
    display: flex;
    justify-content: center;
}

.avatar-shape-btn {
    width: 68px;
    height: 68px;
    min-width: 68px;
    min-height: 68px;
    padding: 0;
    background-color: var(--yellow-ref);
    border: 3px solid #000000;
    border-radius: 0;
    box-shadow: 4px 4px 0 #000000;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.avatar-palette__section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.avatar-palette__label {
    font-size: 0.82rem;
    font-weight: 900;
    text-transform: uppercase;
}

.avatar-size-Origin {
    display: grid;
    grid-template-columns: 40px 1fr 40px;
    align-items: center;
    border: 3px solid #000000;
    background-color: #FFFFFF;
    box-shadow: 3px 3px 0 #000000;
}

.avatar-size-step-btn {
    height: 34px;
    padding: 0;
    border: none;
    background-color: var(--bg-page);
    color: #000000;
    font-family: inherit;
    font-size: 1.2rem;
    font-weight: 900;
    cursor: pointer;
}

.avatar-size-step-btn:first-child {
    border-right: 3px solid #000000;
}

.avatar-size-step-btn:last-child {
    border-left: 3px solid #000000;
}

.avatar-size-step-btn:hover {
    background-color: var(--yellow-ref);
}

.avatar-size-val {
    text-align: center;
    font-size: 1rem;
    font-weight: 900;
}

.avatar-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 24px;
    border: 3px solid #000000;
    border-radius: 0;
    outline: none;
    cursor: pointer;
    margin: 0;
}

.avatar-slider--hue {
    background: linear-gradient(
        to right,
        #ff0000 0%,
        #ffff00 17%,
        #00ff00 33%,
        #00ffff 50%,
        #0000ff 67%,
        #ff00ff 83%,
        #ff0000 100%
    );
}

.avatar-slider--tone {
    background: linear-gradient(to right, #000000 0%, #ff0000 50%, #ffffff 100%);
}

.avatar-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 26px;
    background: #FFFFFF;
    border: 3px solid #000000;
    border-radius: 0;
    cursor: pointer;
}

.avatar-slider::-moz-range-thumb {
    width: 14px;
    height: 26px;
    background: #FFFFFF;
    border: 3px solid #000000;
    border-radius: 0;
    cursor: pointer;
}

.avatar-palette__ok {
    width: 100%;
    padding: 8px 12px;
    font-size: 1rem;
}

.avatar-editor-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.avatar-action-btn {
    padding: 10px 8px;
    font-size: 0.92rem;
    font-weight: 900;
    text-transform: uppercase;
    text-align: center;
}

/* Экран выбора номера (3 → 4 → 5 → 6 → 3) */
.avatar-number-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 10px 4px;
}

.avatar-number__heading {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 900;
    text-transform: uppercase;
    text-align: center;
}

.avatar-number-row {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 340px;
}

.avatar-number-box {
    flex: 1 1 auto;
    min-height: 60px;
    padding: 8px 14px;
    border: 4px solid #000000;
    background-color: var(--bg-page);
    box-shadow: 4px 4px 0 #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.85rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.avatar-digits-btn {
    width: 60px;
    min-width: 60px;
    height: 60px;
    padding: 0;
    border: 4px solid #000000;
    background-color: #B494FF;
    color: #000000;
    box-shadow: 4px 4px 0 #000000;
    font-family: inherit;
    font-size: 1.6rem;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.avatar-digits-btn:hover {
    background-color: #A78BFA;
}

.avatar-number-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    flex-wrap: wrap;
}

.avatar-copy-feedback {
    padding: 4px 10px;
    border: 2px solid #000000;
    background-color: #86EFAC;
    font-size: 0.85rem;
    font-weight: 900;
}

/* Экран глобального ожидания (MM:SS) */
.avatar-cooldown-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 12px 6px;
    text-align: center;
}

.avatar-cooldown__label {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 900;
}

.avatar-cooldown__timer {
    min-width: 180px;
    padding: 10px 18px;
    border: 4px solid #000000;
    background-color: var(--yellow-ref);
    box-shadow: 4px 4px 0 #000000;
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 0.06em;
}

@media (max-width: 540px) {
    .avatar-modal-backdrop {
        padding: 6px;
    }

    .avatar-modal {
        width: 100%;
        box-shadow: 4px 4px 0 #000000;
    }

    .avatar-modal__header {
        padding: 6px 10px;
        min-height: 46px;
    }

    .avatar-modal__title {
        font-size: 1.05rem;
    }

    .avatar-modal__body {
        padding: 10px;
        gap: 10px;
    }

    .avatar-editor-main {
        grid-template-columns: minmax(0, 1fr) 50px;
        gap: 8px;
    }

    .avatar-tool-btn {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
        box-shadow: 3px 3px 0 #000000;
    }

    .avatar-palette-popover {
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
    }

    .avatar-editor-actions {
        gap: 6px;
    }

    .avatar-action-btn {
        padding: 8px 4px;
        font-size: 0.78rem;
    }
}

/* =========================================================================
   BLOCK 03B — CHAT FILES & LINKS (ВЛОЖЕНИЯ, ИЗОБРАЖЕНИЯ, ДОКУМЕНТЫ И ССЫЛКИ)
   ========================================================================= */

.chat-stage {
    position: relative;
}

.chat-dropzone-overlay {
    position: absolute;
    inset: 12px;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(254, 240, 138, 0.92);
    border: 4px dashed #000000;
    box-shadow: 6px 6px 0 #000000;
    pointer-events: none;
}

.chat-dropzone-overlay[hidden] {
    display: none !important;
}

.chat-dropzone-overlay__box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 18px 24px;
    background-color: #ffffff;
    border: 3px solid #000000;
    box-shadow: 4px 4px 0 #000000;
    text-align: center;
}

.chat-dropzone-overlay__box strong {
    font-size: 1.1rem;
    font-weight: 900;
}

.chat-dropzone-overlay__box span {
    font-size: 0.85rem;
    font-weight: 700;
}

/* Предпросмотр выбранных файлов перед отправкой */
.chat-attachments-staging {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 10px;
    margin-bottom: 8px;
    background-color: #fef9c3;
    border: 3px solid #000000;
    box-shadow: 3px 3px 0 #000000;
}

.chat-attachments-staging[hidden] {
    display: none !important;
}

.chat-attachments-staging__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.chat-attachments-staging__title {
    font-size: 0.82rem;
    font-weight: 900;
    text-transform: uppercase;
}

.chat-staged-files-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.staged-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 260px;
    padding: 4px 8px;
    background-color: #ffffff;
    border: 2px solid #000000;
    box-shadow: 2px 2px 0 #000000;
    font-size: 0.8rem;
    font-weight: 800;
}

.staged-file-chip__badge {
    padding: 1px 5px;
    background-color: var(--pink-ref, #f472b6);
    border: 2px solid #000000;
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
}

.staged-file-chip__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 145px;
}

.staged-file-chip__size {
    font-size: 0.72rem;
    color: #333333;
    white-space: nowrap;
}

.staged-file-chip__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    background-color: #fca5a5;
    border: 2px solid #000000;
    font-size: 0.75rem;
    font-weight: 900;
    cursor: pointer;
}

.staged-file-chip__remove:hover {
    background-color: #f87171;
}

/* Индикатор прогресса загрузки */
.chat-upload-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    margin-bottom: 8px;
    background-color: #ffffff;
    border: 3px solid #000000;
    box-shadow: 3px 3px 0 #000000;
}

.chat-upload-progress[hidden] {
    display: none !important;
}

.chat-upload-progress__track {
    flex: 1;
    height: 14px;
    background-color: #f3f4f6;
    border: 2px solid #000000;
    overflow: hidden;
}

.chat-upload-progress__fill {
    height: 100%;
    background-color: var(--yellow-ref, #facc15);
    transition: width 0.12s ease;
}

.chat-upload-progress__label {
    font-size: 0.78rem;
    font-weight: 900;
    white-space: nowrap;
}

/* Вложения внутри карточки сообщения */
.msg-attachments {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.msg-attachments__images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.msg-att-image-card {
    display: inline-flex;
    flex-direction: column;
    max-width: 280px;
    background-color: #ffffff;
    border: 3px solid #000000;
    box-shadow: 3px 3px 0 #000000;
    overflow: hidden;
}

.msg-att-image-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    background-color: #f8fafc;
    border: none;
    border-bottom: 2px solid #000000;
    cursor: zoom-in;
    max-width: 280px;
    max-height: 220px;
    overflow: hidden;
}

.msg-att-thumb {
    display: block;
    max-width: 274px;
    max-height: 214px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.msg-att-image-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 8px;
    background-color: #fef9c3;
    font-size: 0.75rem;
    font-weight: 800;
}

.msg-att-image-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 170px;
}

.msg-att-download-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    background-color: #ffffff;
    border: 2px solid #000000;
    color: #000000;
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 900;
    white-space: nowrap;
}

.msg-att-download-link:hover {
    background-color: var(--yellow-ref, #facc15);
}

.msg-attachments__docs {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.msg-att-doc-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    background-color: #ffffff;
    border: 3px solid #000000;
    box-shadow: 3px 3px 0 #000000;
}

.msg-att-doc-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.msg-att-doc-badge {
    flex-shrink: 0;
    padding: 3px 7px;
    background-color: var(--pink-ref, #f472b6);
    border: 2px solid #000000;
    font-size: 0.74rem;
    font-weight: 900;
    text-transform: uppercase;
}

.msg-att-doc-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.msg-att-doc-name {
    font-size: 0.85rem;
    font-weight: 900;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.msg-att-doc-size {
    font-size: 0.74rem;
    font-weight: 700;
    color: #374151;
}

/* Кликабельные ссылки в тексте сообщений */
.msg-inline-link {
    color: #1d4ed8;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-all;
}

.msg-inline-link:hover {
    background-color: #fef08a;
    color: #000000;
}

/* Правая панель: вкладка «Файлы / ссылки» */
.side-media-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
}

.side-media-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.side-media-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    background-color: var(--yellow-ref, #facc15);
    border: 3px solid #000000;
    box-shadow: 2px 2px 0 #000000;
}

.side-media-section__title {
    font-size: 0.84rem;
    font-weight: 900;
    text-transform: uppercase;
}

.side-media-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.side-media-empty {
    padding: 8px 10px;
    background-color: rgba(255, 255, 255, 0.85);
    border: 2px dashed #000000;
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
}

.side-media-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 7px 9px;
    background-color: #ffffff;
    border: 3px solid #000000;
    box-shadow: 2px 2px 0 #000000;
    color: #000000;
    text-decoration: none;
    transition: transform 0.08s ease;
}

.side-media-card:hover {
    background-color: #fef9c3;
    transform: translate(-1px, -1px);
}

.side-media-card__top {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.side-media-card__badge {
    flex-shrink: 0;
    padding: 1px 5px;
    background-color: var(--pink-ref, #f472b6);
    border: 2px solid #000000;
    font-size: 0.68rem;
    font-weight: 900;
    text-transform: uppercase;
}

.side-media-card__badge--link {
    background-color: #93c5fd;
}

.side-media-card__title {
    font-size: 0.82rem;
    font-weight: 900;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.side-media-card__sub {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #374151;
}

.side-media-more-btn {
    width: 100%;
    text-align: center;
}

/* Модальное окно полноразмерного просмотра изображения */
.image-lightbox-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background-color: rgba(0, 0, 0, 0.76);
}

.image-lightbox-backdrop[hidden] {
    display: none !important;
}

.image-lightbox-dialog {
    display: flex;
    flex-direction: column;
    max-width: min(92vw, 1080px);
    max-height: 90vh;
    background-color: #ffffff;
    border: 4px solid #000000;
    box-shadow: 8px 8px 0 #000000;
    overflow: hidden;
}

.image-lightbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background-color: var(--yellow-ref, #facc15);
    border-bottom: 4px solid #000000;
}

.image-lightbox-header__info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.image-lightbox-title {
    font-size: 0.95rem;
    font-weight: 900;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 500px;
}

.image-lightbox-meta {
    font-size: 0.76rem;
    font-weight: 700;
}

.image-lightbox-header__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.image-lightbox-download {
    text-decoration: none;
    color: #000000;
}

.image-lightbox-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background-color: #f8fafc;
    overflow: auto;
    max-height: calc(90vh - 70px);
}

.image-lightbox-img {
    display: block;
    max-width: 100%;
    max-height: calc(90vh - 96px);
    width: auto;
    height: auto;
    object-fit: contain;
    border: 2px solid #000000;
}

/* BLOCK 06: Модерация аватарок */
.avatar-moderation-notice {
    width: 100%;
    margin: 0 0 6px 0;
    padding: 6px 10px;
    border: 2px solid #000000;
    background-color: #fef08a;
    color: #000000;
    font-size: 0.84rem;
    font-weight: 800;
    text-align: center;
}


