:root {
    --bg-primary: #1e1f22;
    --bg-secondary: #2b2d31;
    --bg-tertiary: #313338;
    --bg-input: #383a40;
    --text-primary: #e6e5d4eb;
    --text-secondary: #cac4b0;
    --text-muted: #949ba4;
    --accent: #f2d5a7;
    --accent-hover: #f3f4ebeb;
    --danger: #9c2f31;
    --success: #57f287;
    --border: #3f4147;
    --overlay: rgba(0, 0, 0, 0.6);
    --radius: 8px;
    --radius-sm: 4px;
    --max-content: 960px;
    --panel-width: 260px;
    --top-bar-height: 24px;
    --fab-size: 44px;
    /* Отступ FAB от левого и нижнего края (симметрично) + safe-area для «домика» */
    --fab-edge: 12px;
    --fab-safe-bottom: calc(var(--fab-edge) + env(safe-area-inset-bottom, 0px));
    /* Примерная высота нижней панели с формой поста (FAB сидит над ней на sujet) */
    --sujet-post-form-stack: clamp(175px, 34vh, 270px);
    --transition: 0.2s ease;
    /* Бежевые полупрозрачные акценты (замена старых голубых rgba(88,101,242,...)) */
    --accent-tint-08: rgba(242, 213, 167, 0.08);
    --accent-tint-10: rgba(242, 213, 167, 0.1);
    --accent-tint-25: rgba(242, 213, 167, 0.25);
    --accent-border-hover: rgba(242, 213, 167, 0.5);
}

::selection {
    background: rgba(242, 213, 167, 0.35);
    color: var(--text-primary);
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Сюжет: полноэкранный фон из арта активной локации (под лентой; контраст — .sujet-bg-dim, подстройка вручную) */
.sujet-bg-root {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s ease;
}

.sujet-bg-root.sujet-bg-root--visible {
    opacity: 1;
    visibility: visible;
}

.sujet-bg-blur {
    position: absolute;
    inset: -36px;
    background-color: var(--bg-primary);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    filter: blur(2px);
    -webkit-filter: blur(2px);
    transform: scale(1.09);
    transform-origin: center center;
    will-change: transform;
}

.sujet-bg-dim {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    pointer-events: none;
}

body.page-sujet main.content {
    position: relative;
    z-index: 1;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Top bar — компактная полупрозрачная полоса (header на большинстве страниц; на /sujet — button на всю ширину) */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    box-sizing: border-box;
    height: var(--top-bar-height);
    margin: 0;
    padding: 0 10px;
    border: none;
    border-bottom: 1px solid rgba(63, 65, 71, 0.65);
    border-radius: 0;
    background: rgba(43, 45, 49, 0.72);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

button.top-bar {
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

button.top-bar:hover {
    background: rgba(50, 52, 58, 0.82);
}

button.top-bar:focus {
    outline: none;
}

button.top-bar:focus-visible {
    outline: 2px solid rgba(120, 170, 255, 0.65);
    outline-offset: -2px;
}

.top-bar__title {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
    text-shadow:
        0 0 2px rgba(0, 0, 0, 0.95),
        0 1px 3px rgba(0, 0, 0, 0.85),
        0 0 12px rgba(0, 0, 0, 0.45),
        1px 1px 0 rgba(0, 0, 0, 0.35);
}

/* Страница инфо: ссылка «назад» слева, заголовок по центру в оставшемся месте */
.top-bar--info {
    justify-content: flex-start;
    gap: 6px;
    padding-left: 6px;
    padding-right: 8px;
}

.top-bar__back {
    flex-shrink: 0;
    max-width: 38%;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow:
        0 0 2px rgba(0, 0, 0, 0.95),
        0 1px 3px rgba(0, 0, 0, 0.85),
        0 0 8px rgba(0, 0, 0, 0.4);
}

.top-bar__back:hover {
    text-decoration: underline;
}

.top-bar__title--with-back {
    flex: 1;
    min-width: 0;
}

/* Модалка «Контекст»: локация / сюжет / мир */
.modal-content--context-info {
    max-width: min(520px, 96vw);
    max-height: min(85vh, 720px);
    overflow-y: auto;
    text-align: left;
}

.context-info-modal__block {
    margin-bottom: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(63, 65, 71, 0.65);
}

.context-info-modal__block:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.context-info-modal__h {
    margin: 0 0 10px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.context-info-modal__strong {
    margin: 0 0 8px;
    font-weight: 600;
    font-size: 0.9375rem;
}

.context-info-modal__desc {
    font-size: 0.875rem;
    line-height: 1.45;
    margin-bottom: 10px;
    white-space: pre-wrap;
}

.context-info-modal__desc--short {
    color: var(--text-muted);
}

.context-info-modal__muted {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0;
}

.context-info-modal__links {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.context-info-modal__link {
    font-size: 0.875rem;
    color: var(--accent, #7eb6ff);
    text-decoration: none;
}

.context-info-modal__link:hover {
    text-decoration: underline;
}

button.context-info-modal__link {
    background: none;
    border: none;
    padding: 0;
    text-align: left;
    width: 100%;
    cursor: pointer;
    font: inherit;
}

.modal-content--info-nested {
    max-width: min(540px, 96vw);
    min-width: 0;
    max-height: min(88vh, 760px);
    overflow-y: auto;
    text-align: left;
}

.modal-content--info-nested__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

/* Модалка «Новый материал» с Markdown-редактором */
.modal-content--info-editor {
    max-width: min(560px, 96vw);
    max-height: min(90vh, 800px);
    overflow-y: auto;
    text-align: left;
}

.info-md-modal__hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0 0 16px;
    line-height: 1.45;
}

.info-md-modal__hint code {
    font-size: 0.85em;
}

.info-md-form .info-md-editor {
    margin-top: 4px;
}

.info-md-editor {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-editor__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.info-editor__toolbar--top {
    margin-bottom: 2px;
}

.info-editor__toolbar--bottom {
    margin-top: 4px;
    justify-content: flex-start;
    gap: 8px;
}

.modal-content--info-editor .info-editor__toolbar .toolbar-btn,
.modal-content--info-editor .info-editor__toolbar .btn-file,
.modal-content--info-editor .info-editor__toolbar .btn-preview,
.modal-content--info-editor .info-h-details__summary {
    background: rgba(49, 51, 56, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-content--info-editor .info-editor__toolbar .toolbar-btn:hover,
.modal-content--info-editor .info-editor__toolbar .btn-file:hover,
.modal-content--info-editor .info-editor__toolbar .btn-preview:hover,
.modal-content--info-editor .info-h-details__summary:hover {
    background: rgba(56, 58, 64, 0.88);
}

.info-md-editor .js-info-md-textarea {
    min-height: 200px;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border-radius: var(--radius);
    border: 1px solid rgba(63, 65, 71, 0.7);
    background: rgba(22, 23, 26, 0.55);
    color: var(--text-primary);
    font-size: 0.9375rem;
    line-height: 1.5;
    resize: vertical;
    font-family: inherit;
}

.info-md-editor .js-info-md-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.info-md-editor .md-preview.post__text {
    max-height: 220px;
    overflow: auto;
    padding: 10px 12px;
    margin: 0;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: rgba(18, 19, 22, 0.65);
    font-size: 0.9rem;
}

.info-md-form__submit {
    margin-left: auto;
}

.info-h-details {
    position: relative;
}

.info-h-details__summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 28px;
    min-height: 28px;
    padding: 4px 8px;
    font-size: 0.8125rem;
    line-height: 1;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.info-h-details__summary:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.info-h-details__summary::-webkit-details-marker {
    display: none;
}

.info-h-details__menu {
    position: absolute;
    z-index: 5;
    left: 0;
    top: calc(100% + 4px);
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 7rem;
    padding: 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.info-h-details__opt {
    display: block;
    width: 100%;
    text-align: left;
    padding: 6px 10px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 0.875rem;
    cursor: pointer;
}

.info-h-details__opt:hover {
    background: var(--bg-tertiary);
}

/* Только иконка скрепки в панелях поста / инфо */
.toolbar-btn.btn-attach-img-icon {
    font-size: 1rem;
    padding: 4px 6px;
    min-width: 28px;
}

/* Модалка вставки картинки (URL / файл / буфер) */
.attach-img-modal__hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0 0 12px;
    line-height: 1.45;
}

.attach-img-modal__url-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.attach-img-modal__url-input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.875rem;
}

.attach-img-modal__file-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    cursor: pointer;
}

.attach-img-modal__file-label input[type="file"] {
    display: block;
    margin-top: 6px;
    font-size: 0.8125rem;
    max-width: 100%;
}

.info-nested__title {
    margin: 0 0 12px;
    font-size: 1.05rem;
    font-weight: 600;
}

.info-nested__html {
    font-size: 0.875rem;
    line-height: 1.5;
    min-width: 0;
}

.info-nested__html img {
    max-width: 100%;
    width: auto;
    height: auto;
    display: block;
    border-radius: var(--radius);
    margin-top: 8px;
    box-sizing: border-box;
    object-fit: contain;
    cursor: zoom-in;
}

.context-info-modal__art {
    text-align: center;
    margin: 8px 0;
}

.context-info-modal__art img {
    max-width: 100%;
    max-height: 240px;
    border-radius: 8px;
    cursor: zoom-in;
}

.context-info-modal__card {
    margin-top: 8px;
}

.context-info-modal__actions {
    margin: 10px 0 0;
}

.btn-linklike {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--accent, #7eb6ff);
    cursor: pointer;
    text-decoration: underline;
}

.btn-linklike:hover {
    opacity: 0.9;
}

.nav-btn {
    background: rgba(30, 31, 34, 0.22);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    border: 1px solid #f3f4eb71;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    width: var(--fab-size);
    height: var(--fab-size);
    border-radius: var(--radius);
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    line-height: 1;
    position: fixed;
    /* Нижние углы совпадают с колонкой .content (max-width), не разъезжаются на широком экране */
    left: max(var(--fab-edge), calc(50vw - var(--max-content) / 2 + var(--fab-edge)));
    bottom: var(--fab-safe-bottom);
    z-index: 75;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* FAB над фиксированной формой поста (только когда форма показана автору) */
body.page-sujet.page-sujet--has-post-form .nav-btn {
    bottom: calc(var(--fab-safe-bottom) + var(--sujet-post-form-stack));
}

/* Свернутая форма поста: FAB снизу слева; кнопка разворота — справа (как nav-btn) */
body.page-sujet.page-sujet--has-post-form.page-sujet--composer-collapsed .nav-btn,
body.page-sujet.page-sujet--has-post-form.page-sujet--composer-collapsed .nav-btn.nav-btn--right {
    bottom: var(--fab-safe-bottom);
}

body.page-sujet.page-sujet--has-post-form.page-sujet--composer-collapsed .content {
    padding-bottom: calc(16px + var(--fab-size) + env(safe-area-inset-bottom, 0px));
}

body.page-sujet--composer-collapsed #post-form-wrapper {
    display: none !important;
}

#btn-composer-expand {
    display: none;
    z-index: 75;
}

body.page-sujet.page-sujet--has-post-form.page-sujet--composer-collapsed #btn-composer-expand {
    display: flex;
}

.nav-btn--right {
    left: auto;
    right: max(var(--fab-edge), calc(50vw - var(--max-content) / 2 + var(--fab-edge)));
}

html.nav-auth-unknown .side-nav__auth-only,
html.nav-auth-unknown .side-nav__queue-nav {
    visibility: hidden;
}

/* Traffic-light badges on hamburger (FAB, нижний левый угол) */
.nav-btn__badges {
    position: absolute;
    top: 2px;
    right: 2px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    pointer-events: none;
}

.nav-btn__dot {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 14px;
    height: 14px;
    border-radius: 7px;
    padding: 0 3px;
    font-size: 0.5625rem;
    font-weight: 700;
    color: #7b7671;
    line-height: 1;
}

.nav-btn__dot--red {
    background: var(--danger);
}

.nav-btn__dot--blue {
    background: var(--accent);
}

.nav-btn__dot--green {
    background: var(--success);
    color: #1e1f22;
}

.nav-btn:hover {
    background: rgba(49, 51, 56, 0.42);
    border-color: var(--accent-border-hover);
    color: var(--text-primary);
}

/* Side panels — полупрозрачные, как верхняя полоса */
.side-panel {
    position: fixed;
    top: var(--top-bar-height);
    bottom: 0;
    width: var(--panel-width);
    background: rgba(43, 45, 49, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 90;
    transition: transform var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.side-panel--left {
    left: 0;
    transform: translateX(-100%);
    border-right: 1px solid rgba(63, 65, 71, 0.65);
    overscroll-behavior: contain;
}

.side-panel .side-nav {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* Меню якорится к низу панели; спейсер сжимается при раскрытии уведомлений/очередей */
.side-nav--anchored-bottom {
    flex: 1;
    min-height: 0;
}

.side-nav__spacer {
    flex: 1 1 0;
    min-height: 0;
}

.side-nav__menu {
    flex: 0 0 auto;
}

.side-nav__bottom {
    border-top: 1px solid var(--border);
    padding-top: 8px;
    margin-top: 4px;
}

/* Sujeti page: list reversed and bottom-aligned */
.content--bottom {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.sujet-list--reversed {
    display: flex;
    flex-direction: column-reverse;
}

.side-panel.open {
    transform: translateX(0);
}

.side-nav__link {
    display: block;
    padding: 10px 12px;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    transition: background var(--transition);
}

.side-nav__link:hover, .side-nav__link--active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    text-decoration: none;
}

.side-nav__teaser {
    padding: 8px 12px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

.side-nav__teaser-full {
    padding: 6px 12px 8px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.4;
    opacity: 0.8;
    white-space: pre-line;
}

.side-nav__label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    padding: 10px 12px 4px;
    margin: 0;
}

.sujet-info-links {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.content--info .info-article {
    max-width: var(--max-content);
    margin: 0 auto;
}

.page-info .post__text {
    padding-top: 4px;
}

/* Overlay */
.overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 80;
    display: none;
}

.overlay.visible {
    display: block;
}

/* Content */
.content {
    margin-top: var(--top-bar-height);
    padding: 16px;
    padding-bottom: calc(16px + var(--fab-size) + env(safe-area-inset-bottom, 0px));
    max-width: var(--max-content);
    margin-left: auto;
    margin-right: auto;
    min-height: calc(100vh - var(--top-bar-height));
    min-height: calc(100dvh - var(--top-bar-height));
}

/* Сюжет: резерв под fixed-форму; у читателей — как у остальных страниц (FAB) */
body.page-sujet:not(.page-sujet--has-post-form) .content {
    padding-bottom: calc(16px + var(--fab-size) + env(safe-area-inset-bottom, 0px));
}

body.page-sujet.page-sujet--has-post-form .content {
    padding-bottom: calc(var(--sujet-post-form-stack) + 16px + env(safe-area-inset-bottom, 0px));
}

/* Loading */
.loading {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 0;
}

/* Cards */
.card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 8px;
 /*   border: 1px solid var(--border);*/
    transition: background var(--transition);
}

a.card, .card {
    display: block;
}

.card:hover {
    background: var(--bg-tertiary);
}

.card__title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.sujet-posts-badge {
    display: inline-block;
    vertical-align: middle;
    margin-left: 6px;
    margin-right: 6px;
    padding: 1px 8px;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.35;
    color: #4a4338;
    background: var(--accent);
    border-radius: 999px;
}

.context-info-modal__sujet-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.context-info-modal__sujet-row .sujet-posts-badge {
    margin-left: 0;
}

.card__teaser {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Список сюжетов: ссылка на сюжет и отдельная кнопка «Мир» (без вложенной интерактивности) */
.sujet-card {
    padding: 14px 16px;
}

/* Две колонки: название слева (переносится), «Мир» всегда в правой колонке */
.sujet-card__title-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    column-gap: 8px;
    margin-bottom: 4px;
    font-size: 1rem;
    font-weight: 600;
}

.sujet-card__title-link {
    color: inherit;
    text-decoration: none;
    min-width: 0;
}

.sujet-card__title-link:hover .card__title-text {
    text-decoration: underline;
}

.sujet-card__teaser-link {
    display: block;
    margin-top: 2px;
    color: inherit;
    text-decoration: none;
}

.sujet-card__teaser-link:hover .card__teaser {
    text-decoration: underline;
}

.card__title-text {
    font-weight: 600;
}

.card__world-btn {
    display: inline-block;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
    justify-self: end;
    text-align: right;
}

.card__world-btn:hover {
    color: var(--accent);
}

/* Posts — аватар с float + shape-outside, текст обтекает и продолжается под ним */
.post {
    display: flow-root;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.post__body {
    display: contents;
}

.post__avatar {
    float: left;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    object-fit: cover;
    cursor: pointer;
    margin: 0 12px 8px 0;
    shape-outside: circle(50% at 50% 50%);
    shape-margin: 6px;
}

.post__header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
    margin-left: calc(40px + 12px);
    min-height: 0;
}

.post__images {
    clear: both;
    margin-top: 8px;
}

.post__author {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--accent);
    cursor: pointer;
}

.post__author:hover {
    text-decoration: underline;
}

.post__time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.post__actions {
    margin-left: auto;
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity var(--transition);
}

.post:hover .post__actions {
    opacity: 1;
}

.post__btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    line-height: 1;
    opacity: 0.6;
    transition: opacity var(--transition);
}

.post__btn:hover {
    opacity: 1;
    background: var(--bg-tertiary);
}

.post__edit-form {
    margin-top: 6px;
    clear: both;
}

.post__edit-form textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    min-height: 60px;
}

.post__edit-form textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.post__edit-btns {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.post__edit-btns button {
    padding: 4px 12px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8125rem;
}

.post__edit-btns .btn-save {
    background: var(--accent);
    color: #fff;
}

.post__edit-btns .btn-cancel {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.post__text {
    font-size: 0.9375rem;
    line-height: 1.6;
    word-break: break-word;
    min-width: 0; /* чтобы img с max-width:100% не раздували flex/grid */
}

.post__text p {
    margin: 0 0 0.65em 0;
    text-indent: 30px;
}

.post__text p:first-child {
    text-indent: 0;
}

.post__text img,
.md-preview.post__text img {
    max-width: 100%;
    width: auto;
    height: auto;
    display: block;
    border-radius: var(--radius);
    margin-top: 8px;
    box-sizing: border-box;
    object-fit: contain;
    cursor: zoom-in;
}

/* Модалка просмотра вложенного инфо — картинка по ширине окна модалки */
.modal-content--info-nested .info-nested__html img,
.modal-content--info-nested .post__text img {
    max-width: 100%;
    width: auto;
    height: auto;
}

/* Location divider — симметричные линии слева/справа от подписи */
.loca-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    width: 100%;
    min-width: 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.loca-divider::before,
.loca-divider::after {
    content: '';
    flex: 1 1 0;
    min-width: 0;
    height: 1px;
    background: var(--border);
}

.loca-divider__name {
    flex-shrink: 0;
    max-width: 100%;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--accent);
    line-height: 1.3;
}

/* Auth forms */
.login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.login-page h1 {
    font-size: 2rem;
    margin-bottom: 4px;
}

.login-subtitle {
    color: var(--text-muted);
    margin-bottom: 12px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 340px;
}

.modal-content .auth-form {
    max-width: 100%;
}

.auth-form input,
.auth-form textarea {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.9375rem;
    outline: none;
    transition: border var(--transition);
    font-family: inherit;
    line-height: 1.45;
}

.auth-form textarea {
    min-height: 140px;
    resize: vertical;
}

.auth-form input:focus,
.auth-form textarea:focus {
    border-color: var(--accent);
}

.auth-form button {
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    padding: 10px;
    color: #7b7671;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
}

.auth-form button:hover {
    background: var(--accent-hover);
}

.auth-switch {
    width: 100%;
    max-width: 340px;
    margin: 0 0 16px;
    color: var(--text-muted);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.auth-switch button {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.875rem;
}

.error-msg {
    background: rgba(237, 66, 69, 0.15);
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: var(--radius);
    padding: 8px 14px;
    font-size: 0.875rem;
    max-width: 340px;
    width: 100%;
    margin-bottom: 8px;
}

/* Chat — list in side nav (under «Чаты», same idea as queue-panel / notif-panel) */
.chat-list-panel {
    border-top: 1px solid var(--border);
    margin-top: 8px;
    padding-top: 8px;
    max-height: 40vh;
    overflow-y: auto;
}

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

.chat-list-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
    padding: 8px 4px 12px;
    line-height: 1.4;
}

.chat-sidebar-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: background var(--transition);
}

.chat-sidebar-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.chat-sidebar-item--active {
    background: var(--accent-tint-10);
    border-left: 2px solid var(--accent);
    padding-left: 8px;
    color: var(--text-primary);
}

.chat-message {
    padding: 6px 0;
    font-size: 0.9375rem;
}

.chat-message__author {
    font-weight: 600;
    margin-right: 6px;
}

.chat-message__platform {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-right: 4px;
}

.chat-message__time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.chat-message__text {
    display: block;
    margin-top: 4px;
    white-space: pre-wrap;
    word-break: break-word;
}

#chat-feed {
    padding-bottom: 70px;
}

.chat-input {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px 12px calc(16px + var(--fab-size) + 8px);
    background: var(--bg-secondary);
    z-index: 10;
    border-top: 1px solid var(--border);
    max-width: var(--max-content);
    margin: 0 auto;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

.chat-input textarea[name="text"] {
    flex: 1;
    min-height: 44px;
    max-height: 160px;
    resize: none;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: inherit;
    line-height: 1.45;
    outline: none;
}

.chat-input textarea[name="text"]:focus {
    border-color: var(--accent);
}

.chat-input button {
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    padding: 10px 16px;
    color: #7b7671;
    font-size: 1.1rem;
    cursor: pointer;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

/* Поверх #modal (форма «Новый материал») — вставка картинки отдельным слоем */
#attach-img-overlay.modal-overlay {
    z-index: 250;
}

/* Полноэкранный просмотр картинки: вписать в экран + зум и панорамирование */
#img-viewer-overlay.img-viewer-overlay {
    position: fixed;
    inset: 0;
    z-index: 280;
    display: none;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    background: rgba(10, 10, 12, 0.94);
    -webkit-tap-highlight-color: transparent;
}

.img-viewer__close {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition);
}

.img-viewer__close:hover {
    background: rgba(0, 0, 0, 0.65);
}

.img-viewer__stage {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none;
    cursor: grab;
    user-select: none;
}

.img-viewer__stage--dragging {
    cursor: grabbing;
}

.img-viewer__pan {
    transform-origin: center center;
    will-change: transform;
}

.img-viewer__img {
    display: block;
    max-width: none;
    height: auto;
    pointer-events: none;
    -webkit-user-drag: none;
    user-select: none;
}

.img-viewer__hint {
    flex-shrink: 0;
    margin: 0;
    padding: 4px 16px max(12px, env(safe-area-inset-bottom, 12px));
    text-align: center;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.35;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 480px;
    width: 100%;
    min-width: 0; /* flex: широкий контент (img) не ломает центрирование */
    max-height: 80vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

body.modal-open {
    overflow: hidden;
}

.modal-content h2 {
    margin: 0 0 12px;
    font-size: 1.25rem;
    padding-right: 36px;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.pers-modal__avatar {
    float: right;
    width: 50%;
    max-width: 220px;
    margin: 0 0 12px 16px;
    border-radius: 0;
    object-fit: cover;
}

/* Spoiler text */
.spoiler {
    background: var(--bg-input);
    color: transparent;
    border-radius: var(--radius-sm);
    padding: 0 4px;
    cursor: pointer;
    transition: color var(--transition);
}

.spoiler.revealed, .spoiler:hover {
    color: var(--text-primary);
}

/* Desktop: контент по центру */
@media (min-width: 1024px) {
    .content {
        margin-left: auto;
        margin-right: auto;
    }
}

/* Форма поста — только sujet.html: липнет к низу; стекло как у верхней полосы / боковой панели */
.post-form-shell {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    width: 100%;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: flex-end;
   /* padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));*/
    box-sizing: border-box;
/*    background: rgba(43, 45, 49, 0.72);*/
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
  /*  border-top: 1px solid rgba(63, 65, 71, 0.65);*/
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.18);
}

.post-form-shell .post-form {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin-top: 0;
    bottom: auto;
}

@media (min-width: 480px) {
    .post-form-shell .post-form {
        max-width: 75%;
    }
}

.post-form {
    background: rgba(47, 49, 54, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(63, 65, 71, 0.65);
    padding: 12px;
    border-radius: var(--radius);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.12);
}

.post-form textarea {
    width: 100%;
    background: rgba(56, 58, 64, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(63, 65, 71, 0.7);
    border-radius: var(--radius);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.9375rem;
    resize: none;
    font-family: inherit;
    line-height: 1.5;
}

.post-form textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* Кнопки внутри формы — тот же лёгкий стеклянный слой */
.post-form .toolbar-btn,
.post-form .persi-selector,
.post-form .btn-file,
.post-form .btn-loca,
.post-form .btn-preview,
.post-form .post-form__resize-handle {
    background: rgba(49, 51, 56, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.post-form .toolbar-btn:hover,
.post-form .persi-selector:hover,
.post-form .btn-file:hover,
.post-form .btn-loca:hover,
.post-form .btn-preview:hover {
    background: rgba(56, 58, 64, 0.88);
}

.post-form .post-form__resize-handle:hover {
    background: rgba(56, 58, 64, 0.88);
    border-color: var(--accent);
    color: var(--text-primary);
}

.post-form .persi-selector:hover {
    border-color: var(--accent);
}

.post-form__actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.post-form__actions .btn-action {
    margin: 0;
    flex: 0 1 auto;
}

.btn-loca {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    padding: 6px 10px;
    font-size: 0.8125rem;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    transition: background var(--transition), color var(--transition);
}

.btn-loca:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.btn-file {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    transition: background var(--transition), color var(--transition);
}

.btn-file:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.btn-preview {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    padding: 6px 10px;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.btn-preview:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.btn-preview--active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-more {
    display: block;
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    padding: 10px;
    cursor: pointer;
    margin-top: 8px;
    font-size: 0.875rem;
    transition: background var(--transition);
}

.btn-more:hover {
    background: var(--bg-tertiary);
}

/* Markdown rendering */
.post__text strong { font-weight: 700; }
.post__text em { font-style: italic; }
.post__text u,
.md-preview.post__text u {
    text-decoration: underline;
}
.post__text del,
.post__text s,
.md-preview.post__text del,
.md-preview.post__text s {
    text-decoration: line-through;
    opacity: 0.92;
}
.post__text ul,
.post__text ol,
.md-preview.post__text ul,
.md-preview.post__text ol {
    margin: 0.5em 0;
    padding-left: 1.35em;
}
.post__text li,
.md-preview.post__text li {
    margin: 0.2em 0;
}
.post__text h1,
.post__text h2,
.post__text h3 {
    font-weight: 600;
    line-height: 1.3;
    margin: 10px 0 8px;
    color: var(--text-primary);
}
.post__text h1 { font-size: 1.125rem; }
.post__text h2 { font-size: 1.0625rem; }
.post__text h3 { font-size: 1rem; }
.post__text hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 12px 0;
}

/* Цитата — в духе активного уведомления / «ваш ход» в очереди */
.post__text blockquote,
.md-preview.post__text blockquote {
    margin: 10px 0;
    padding: 8px 10px 8px 12px;
    border-radius: var(--radius-sm);
    background: var(--accent-tint-08);
    border-left: 2px solid var(--accent);
    color: var(--text-primary);
}

.post__text blockquote p,
.md-preview.post__text blockquote p {
    margin: 0 0 0.5em 0;
    text-indent: 0;
}

.post__text blockquote p:last-child,
.md-preview.post__text blockquote p:last-child {
    margin-bottom: 0;
}

/* Строчный и блочный код — тонкая рамка, тёмный фон (как «кнопочный» стиль) */
.post__text code,
.md-preview.post__text code {
    font-family: ui-monospace, 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.88em;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(22, 23, 26, 0.82);
    color: var(--text-primary);
}

.post__text pre,
.md-preview.post__text pre {
    margin: 10px 0;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(22, 23, 26, 0.82);
    overflow-x: auto;
}

.post__text pre code,
.md-preview.post__text pre code {
    padding: 0;
    border: none;
    background: transparent;
    font-size: 0.875rem;
}

/* Post images (вложение отдельным полем) */
.post__images {
    min-width: 0;
}

.post__image {
    max-width: 100%;
    width: auto;
    height: auto;
    max-height: min(400px, 70vh);
    display: block;
    object-fit: contain;
    border-radius: var(--radius);
    cursor: zoom-in;
    box-sizing: border-box;
}

/* Action buttons */
.btn-action {
    display: block;
    width: 100%;
    background: var(--accent);
    color: #383532;
    border: none;
    border-radius: var(--radius);
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.875rem;
    margin: 8px 0;
    transition: opacity var(--transition);
}
.btn-action:hover { opacity: 0.85; }
.btn-action--sm {
    display: inline-block;
    width: auto;
    padding: 6px 12px;
    font-size: 0.8125rem;
}

/* Post form top row: character selector + toolbar + размер поля */
.post-form__top-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.post-form__resize-handle {
    margin-left: auto;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: nwse-resize;
    touch-action: none;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.post-form__resize-handle:hover {
    background: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--accent);
}

.post-form__resize-icon {
    flex-shrink: 0;
    display: block;
}

.post-form__toolbar {
    display: flex;
    gap: 4px;
    flex: 1;
    justify-content: center;
}

.toolbar-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    padding: 4px 8px;
    font-size: 0.8125rem;
    cursor: pointer;
    line-height: 1;
    transition: background var(--transition), color var(--transition);
    min-width: 28px;
    text-align: center;
}

.toolbar-btn:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.toolbar-btn--active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Character selector */
.persi-selector {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2px;
    cursor: pointer;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color var(--transition);
}

.persi-selector:hover {
    border-color: var(--accent);
}

.persi-selector__icon {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

/* Character grid */
.persi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 6px;
    padding: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.persi-grid.hidden {
    display: none;
}

.persi-grid__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
    border: 2px solid transparent;
}

.persi-grid__item:hover {
    background: var(--bg-input);
}

.persi-grid__item--selected {
    border-color: var(--accent);
    background: var(--bg-input);
}

.persi-grid__ava {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--bg-secondary);
}

.persi-grid__name {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    text-align: center;
    max-width: 68px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Markdown preview — reuses .post__text styles for visual consistency */
.md-preview {
    background: rgba(49, 51, 56, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(63, 65, 71, 0.65);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 6px;
    max-height: 300px;
    overflow-y: auto;
}

/* Notification badge */
.notif-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--danger);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    padding: 0 5px;
    margin-left: 6px;
    vertical-align: middle;
}

.side-nav__link--notif {
    display: flex;
    align-items: center;
}

/* Пока открыта панель уведомлений, пункт «Уведомления» в меню скрыт (заголовок дублируется в панели) */
#notif-toggle.notif-toggle--panel-open {
    display: none !important;
}

/* Notification panel (inside side-panel) */
.notif-panel {
    border-top: 1px solid var(--border);
    margin-top: 8px;
    padding-top: 8px;
    max-height: 50vh;
    overflow-y: auto;
}

.notif-panel__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px 8px;
}

.notif-panel__title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.notif-panel__title:hover {
    color: var(--text-primary);
}

.notif-panel__mark-all {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 2px 4px;
}

.notif-panel__mark-all:hover {
    text-decoration: underline;
}

/* Notification list items */
.notification-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notification-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
    padding: 16px 0;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.notification-item:hover {
    background: var(--bg-tertiary);
}

.notification-item--unread {
    background: var(--accent-tint-08);
    border-left: 2px solid var(--accent);
}

.notification-item__icon {
    font-size: 1rem;
    flex-shrink: 0;
    line-height: 1;
    margin-top: 2px;
}

.notification-item__body {
    flex: 1;
    min-width: 0;
}

.notification-item__text {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-primary);
    line-height: 1.3;
}

.notification-item__time {
    display: block;
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.notification-item__link {
    color: var(--accent);
    font-size: 1rem;
    flex-shrink: 0;
    padding: 2px 4px;
    text-decoration: none;
}

.notification-item__link:hover {
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}

/* @mention autocomplete popup */
.mention-popup {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 4px;
    max-height: 180px;
    overflow-y: auto;
    z-index: 50;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.3);
}

.mention-popup__item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-primary);
    padding: 8px 12px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background var(--transition);
}

.mention-popup__item:hover,
.mention-popup__item--active {
    background: var(--accent-tint-10);
}

/* My characters grid (profile page) */
.my-pers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.my-pers-grid__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition);
    border: 1px solid transparent;
}

.my-pers-grid__item:hover {
    background: var(--bg-tertiary);
    border-color: var(--border);
}

.my-pers-grid__ava {
    width: 64px;
    height: 64px;
    border-radius: var(--radius);
    object-fit: cover;
    background: var(--bg-secondary);
}

.my-pers-grid__name {
    font-size: 0.75rem;
    color: var(--text-primary);
    text-align: center;
    word-break: break-word;
    line-height: 1.3;
    max-width: 86px;
}

/* Character creation form */
.pers-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin-top: 12px;
}

.pers-form input,
.pers-form textarea,
.pers-form select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: inherit;
    outline: none;
    transition: border var(--transition);
    width: 100%;
}

.pers-form select {
    cursor: pointer;
    appearance: auto;
}

.pers-form input:focus,
.pers-form textarea:focus,
.pers-form select:focus {
    border-color: var(--accent);
}

.pers-form textarea {
    resize: vertical;
    line-height: 1.5;
}

.pers-form__ava-section {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.pers-form__ava-preview {
    width: 100px;
    height: 100px;
    border-radius: var(--radius);
    object-fit: cover;
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.pers-form__ava-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pers-form__ava-btn {
    cursor: pointer;
    text-align: center;
}

.pers-form__ava-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.pers-form__row {
    display: flex;
    gap: 12px;
}

.pers-form__world-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
    flex-wrap: wrap;
}

.pers-form__world-row select {
    flex: 1 1 180px;
    min-width: 0;
}

.pers-form__world-row .btn-action {
    flex: 0 0 auto;
    align-self: center;
    white-space: nowrap;
}

.pers-form__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pers-form__field--grow {
    flex: 1;
}

.pers-form__label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.pers-form__counter {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-left: auto;
}

.pers-form__counter--warn {
    color: #faa61a;
}

.pers-form__counter--over {
    color: var(--danger);
    font-weight: 700;
}

/* Highlight animation for pinged messages/posts */
.highlight-ping {
    animation: ping-flash 3s ease-out;
}

@keyframes ping-flash {
    0%, 15% {
        background: var(--accent-tint-25);
        box-shadow: 0 0 0 2px var(--accent);
    }
    100% {
        background: transparent;
        box-shadow: none;
    }
}

.chat-message.highlight-ping,
.post.highlight-ping {
    border-radius: var(--radius-sm);
}

/* Queue panel (inside side-panel, similar to notif-panel) */
.queue-panel {
    border-top: 1px solid var(--border);
    margin-top: 8px;
    padding-top: 8px;
    max-height: 50vh;
    overflow-y: auto;
}

.queue-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.queue-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
    padding: 12px 4px;
    line-height: 1.4;
}

.queue-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.queue-item:hover {
    background: var(--bg-tertiary);
}

.queue-item--current {
    background: var(--accent-tint-10);
    border-left: 2px solid var(--accent);
}

.queue-item__ava {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.queue-item__name {
    flex: 1;
    font-size: 0.8125rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.queue-item__arrow {
    color: var(--accent);
    font-size: 0.75rem;
    flex-shrink: 0;
}

.queue-item__leave {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.875rem;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
    flex-shrink: 0;
}

.queue-item__leave:hover {
    color: var(--danger);
    background: rgba(237, 66, 69, 0.1);
}

.queue-turn-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #7b7671;
    font-size: 0.6875rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    padding: 0 5px;
    margin-left: 6px;
    vertical-align: middle;
}

/* Global queues list (all sujets where user participates) */
.queues-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.queues-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-primary);
    transition: background var(--transition);
}

.queues-item:hover {
    background: var(--bg-tertiary);
    text-decoration: none;
}

.queues-item--turn {
    background: var(--accent-tint-08);
    border-left: 2px solid var(--accent);
}

.queues-item__name {
    flex: 1;
    font-size: 0.8125rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.queues-item__pers {
    font-size: 0.6875rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.queues-item__badge {
    background: var(--accent);
    color: #7b7671;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 9px;
    white-space: nowrap;
    flex-shrink: 0;
}

.queues-item--current {
    background: var(--accent-tint-25);
    /*background: var(--bg-tertiary);*/
    border-left: 2px solid var(--accent);
    cursor: default;
}

.queues-item__detail {
    padding: 4px 0 4px 10px;
    border-left: 2px solid var(--border);
    margin-left: 8px;
    margin-bottom: 4px;
}

.hidden {
    display: none !important;
}
