/* Гостиная: вёрстка движка. Ни одного цвета факультета: все цвета и шрифты приходят
   из токенов темы (theme/tokens.css), обстановка из theme/room.css. */

/* ---------- Основа ---------- */

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

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

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

/* Фон комнаты задаёт тема (--room-bg); по умолчанию просто цвет. */
.lounge-page {
  background: var(--room-bg, var(--bg));
  background-attachment: fixed;
}

h1, h2, h3, p { margin: 0; }

a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--heading); }

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  border-radius: 6px;
}

svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 50;
  padding: 8px 14px; border-radius: var(--radius-sm);
  background: var(--glow); color: var(--on-glow); font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---------- Кнопки ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px;
  border: 1px solid transparent; border-radius: 12px;
  font-weight: 700; text-decoration: none; line-height: 1;
  transition: background-color .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { color: var(--on-accent); background: var(--accent-hover); box-shadow: 0 0 0 3px var(--focus-ring); }
.btn--primary:disabled { opacity: .6; cursor: progress; box-shadow: none; }
.btn--ghost { border-color: var(--line-strong); color: var(--text); background: transparent; }
.btn--ghost:hover { background: var(--hover); color: var(--heading); }
.btn--wide { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); color: var(--text);
}
.icon-btn:hover { background: var(--panel-raised); color: var(--heading); }

/* ---------- Каркас гостиной ---------- */

.lounge {
  display: grid;
  /* ширину колонок задаёт тема: --nav-w (меню), --side-w (правая колонна) */
  grid-template-columns: var(--nav-w, 240px) minmax(0, 1fr) var(--side-w, 268px);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "top  top   top"
    "nav  stage online";
  gap: var(--gap);
  max-width: 1560px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  padding: 14px var(--gap) var(--gap);
}

.panel,
.sidenav,
.online {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- Шапка ---------- */

.topbar {
  grid-area: top;
  display: flex; align-items: center; gap: 14px;
  min-height: 56px;
}
.topbar__nav { display: none; position: relative; }
/* Точка непрочитанного на кнопке меню (на телефоне счётчик спрятан в меню) */
.topbar__dot {
  position: absolute; top: 8px; right: 8px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--glow); box-shadow: 0 0 0 2px var(--panel), 0 0 8px var(--glow);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand__crest {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--metal-line);
  padding: 3px; object-fit: contain;
}
.brand__title {
  font: 700 1.75rem/1.1 var(--font-serif);
  color: var(--heading);
  letter-spacing: .01em;
}
.brand__motto {
  margin-top: 2px;
  font-size: .72rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--metal);
}

.online-chip {
  display: none;
  margin-left: auto;
  align-items: center; gap: 8px;
  min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); color: var(--text);
  font-size: .9rem;
}
.online-chip:hover { background: var(--panel-raised); }
.online-chip__lamp {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--glow); box-shadow: 0 0 8px var(--glow);
}

/* ---------- Меню разделов ---------- */

.sidenav {
  grid-area: nav;
  display: flex; flex-direction: column;
  padding: 12px;
  overflow-y: auto;
}
.sidenav__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sidenav__link {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none;
}
.sidenav__link:hover { background: var(--hover); color: var(--heading); }
.sidenav__link[aria-current="page"] {
  background: var(--selected); color: var(--heading);
  box-shadow: inset 3px 0 0 var(--glow);
}
.sidenav__link svg { color: var(--link); }

.badge {
  margin-left: auto;
  min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: 999px;
  background: var(--glow); color: var(--on-glow);
  font-size: .78rem; font-weight: 700; line-height: 22px; text-align: center;
}

.me {
  display: flex; align-items: center; gap: 10px;
  margin-top: auto; padding: 14px 8px 8px;
  border-top: 1px solid var(--line);
}
.me__text { min-width: 0; }
.me__name { color: var(--heading); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me__rang { color: var(--text-dim); font-size: .85rem; }
.sidenav__exits { display: flex; gap: 16px; padding: 4px 8px 2px; font-size: .9rem; }
.sidenav__exits a { color: var(--text-dim); }
.sidenav__exits a:hover { color: var(--heading); }

/* ---------- Аватар-монограмма ---------- */

.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1.5px solid var(--metal-line);
  color: var(--heading);
  font: 700 .95rem/1 var(--font-serif);
  letter-spacing: .02em;
  user-select: none;
}
.avatar--sm { width: 30px; height: 30px; font-size: .8rem; }
.avatar { position: relative; overflow: hidden; }
/* Портрет лежит поверх монограммы: не загрузился, и под ним уже видны инициалы */
.avatar__img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; border-radius: 50%;
  background: var(--panel);
}
/* Фоны монограмм задаёт тема: --av-0 … --av-5 */
.av-0 { background: var(--av-0); }
.av-1 { background: var(--av-1); }
.av-2 { background: var(--av-2); }
.av-3 { background: var(--av-3); }
.av-4 { background: var(--av-4); }
.av-5 { background: var(--av-5); }

/* ---------- Сцена и панели ---------- */

.stage { grid-area: stage; min-height: 0; display: flex; }
.stage > .panel { flex: 1; min-width: 0; }

.panel__head { padding: 18px 22px 12px; border-bottom: 1px solid var(--line); }
.panel__title { font: 700 1.55rem/1.15 var(--font-serif); color: var(--heading); }
.panel__sub { margin-top: 2px; color: var(--text-dim); font-size: .92rem; }

.stub { padding: 28px; display: flex; flex-direction: column; gap: 10px; }
.stub__text { max-width: 36rem; color: var(--text); }

/* ---------- Чат ---------- */

.chat {
  position: relative;
  display: flex; flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.feed {
  flex: 1; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 10px 12px 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.feed:focus-visible { outline-offset: -2px; }

.feed__older {
  display: block; margin: 6px auto 10px;
  min-height: 36px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: transparent; color: var(--text); font-size: .9rem;
}
.feed__older:hover { background: var(--hover); color: var(--heading); }

.feed__loading, .feed__empty { padding: 48px 16px; text-align: center; color: var(--text-dim); }
.feed__empty-title { font: 700 1.4rem/1.2 var(--font-serif); color: var(--heading); margin-bottom: 4px; }

.messages { list-style: none; margin: 0; padding: 0; }

.day {
  display: flex; align-items: center; gap: 12px;
  margin: 16px 6px 8px;
  color: var(--metal);
  font: 600 1rem/1 var(--font-serif);
  letter-spacing: .04em;
}
.day::before, .day::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }

.msg {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  column-gap: 12px;
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}
.msg:hover { background: var(--hover-faint); }
.msg--cont { margin-top: 0; padding-top: 2px; }
.msg--mine { background: var(--mine); }
.msg--mine:hover { background: var(--mine); }
.msg--mention { background: var(--mention); box-shadow: inset 3px 0 0 var(--glow); }
.msg--new { animation: msg-in .28s ease-out; }

.msg__avatar { grid-row: span 2; align-self: start; }
.msg__head { grid-column: 2; display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.msg__nick {
  padding: 0; border: 0; background: none;
  color: var(--heading); font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.msg__nick:hover { color: var(--link); }
.msg__time { flex: none; color: var(--text-dim); font-size: .78rem; font-variant-numeric: tabular-nums; }
.msg__body {
  grid-column: 2;
  white-space: pre-wrap; overflow-wrap: anywhere;
  line-height: 1.5;
}
.msg__body a { color: var(--link); }
.msg__body a:hover { color: var(--heading); }
.msg__body strong { color: var(--heading); }
.msg--cont .msg__body { position: relative; }
.msg--cont .msg__time--side {
  position: absolute; left: -46px; top: 2px; width: 40px; text-align: right;
  opacity: 0; transition: opacity .12s ease;
}
.msg--cont:hover .msg__time--side,
.msg--cont:focus-within .msg__time--side { opacity: 1; }

@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.jump {
  position: absolute; left: 50%; bottom: 128px; transform: translateX(-50%);
  min-height: 36px; padding: 0 16px;
  border: 0; border-radius: 999px;
  background: var(--glow); color: var(--on-glow); font-weight: 700; font-size: .9rem;
  box-shadow: var(--shadow-pop);
}

.notice {
  margin: 0 14px 8px; padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft); box-shadow: inset 3px 0 0 var(--danger);
  color: var(--text); font-size: .92rem;
}
.notice--soft { background: var(--hover); box-shadow: inset 3px 0 0 var(--link); }

/* ---------- Поле ввода ---------- */

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "typing typing"
    "input  send"
    "hint   counter";
  gap: 6px 10px;
  padding: 6px 14px 12px;
  border-top: 1px solid var(--line);
  background: var(--well);
}
.composer__input {
  grid-area: input;
  display: block; width: 100%;
  min-height: 46px; max-height: 180px;
  padding: 11px 14px;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--bg); color: var(--text);
  line-height: 1.45; resize: none;
}
.composer__input::placeholder { color: var(--text-dim); opacity: 1; }
.composer__input:focus { outline: none; border-color: var(--link); box-shadow: 0 0 0 3px var(--focus-ring); }
.composer__send { grid-area: send; align-self: end; min-height: 46px; }
.composer__hint { grid-area: hint; color: var(--text-dim); font-size: .78rem; }
.composer__counter { grid-area: counter; justify-self: end; color: var(--text-dim); font-size: .78rem; font-variant-numeric: tabular-nums; }
.composer__counter.is-over { color: var(--danger); font-weight: 700; }

/* «печатает…»: строка всегда занимает место, чтобы поле ввода не прыгало */
.typing {
  grid-area: typing;
  min-height: 20px;
  color: var(--text-dim); font-size: .82rem; font-style: italic;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.typing.is-on::after {
  content: "…";
  display: inline-block; width: 1.2em; overflow: hidden; vertical-align: bottom;
  animation: typing-dots 1.2s steps(4, end) infinite;
}
@keyframes typing-dots { from { width: 0; } to { width: 1.2em; } }

/* Удаление сообщения: корзина появляется при наведении, на сенсорных экранах видна всегда */
.msg { position: relative; }
.msg__del {
  position: absolute; top: 4px; right: 6px;
  display: inline-grid; place-items: center;
  min-width: 32px; height: 32px; padding: 0 8px;
  border: 1px solid transparent; border-radius: 8px;
  background: var(--panel-raised); color: var(--text-dim);
  font-size: .82rem; font-weight: 700;
  opacity: 0; transition: opacity .12s ease;
}
.msg__del svg { width: 18px; height: 18px; }
.msg:hover .msg__del,
.msg:focus-within .msg__del,
.msg__del.is-confirm { opacity: 1; }
.msg__del:hover { color: var(--heading); border-color: var(--line-strong); }
.msg__del.is-confirm { color: var(--on-danger); background: var(--danger); }
@media (hover: none) {
  .msg__del { opacity: .7; background: transparent; }
}

/* ---------- Сейчас в гостиной ---------- */

.online {
  grid-area: online;
  padding: 16px 12px;
  overflow-y: auto;
}
.online__title { padding: 0 8px 10px; font: 700 1.25rem/1.2 var(--font-serif); color: var(--heading); }
.online__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.guest {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 44px; padding: 4px 8px;
  border: 0; border-radius: var(--radius-sm);
  background: none; text-align: left;
}
.guest:hover { background: var(--hover); }
.guest__text { min-width: 0; display: grid; }
.guest__name { color: var(--text); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guest__status { display: flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: .8rem; }
.guest__status::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  border: 1.5px solid var(--text-dim);
}
.guest--here .guest__status::before { border: 0; background: var(--glow); box-shadow: 0 0 6px var(--glow); }
.guest--note .guest__status { color: var(--text); }
.guest--note .guest__status::before { display: none; }

/* Мой статус */
.mystatus { position: relative; margin: 0 0 10px; }
.mystatus__btn {
  display: flex; align-items: center; gap: 6px;
  width: 100%; min-height: 40px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--well); color: var(--text);
  font-size: .88rem; text-align: left;
}
.mystatus__btn:hover { background: var(--hover); }
.mystatus__caption { color: var(--text-dim); flex: none; }
.mystatus__value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--heading); }
.mystatus__btn svg { width: 16px; height: 16px; color: var(--text-dim); }
.mystatus__menu {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px);
  display: grid; gap: 2px; padding: 6px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--panel-raised);
  box-shadow: var(--shadow-pop);
}
.mystatus__item {
  min-height: 38px; padding: 0 10px;
  border: 0; border-radius: 8px;
  background: none; color: var(--text); text-align: left; font-size: .9rem;
}
.mystatus__item:hover, .mystatus__item:focus-visible { background: var(--selected); color: var(--heading); }
.mystatus__custom { display: flex; gap: 6px; margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--line); }
.mystatus__input {
  flex: 1; min-width: 0; min-height: 36px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--bg); color: var(--heading); font-size: .9rem;
}
.mystatus__input:focus { outline: none; border-color: var(--link); }
.mystatus__ok { min-height: 36px; padding: 0 12px; font-size: .85rem; }
.online__empty { padding: 4px 8px; color: var(--text-dim); font-size: .9rem; }

.scrim { position: fixed; inset: 0; z-index: 30; background: var(--scrim); }

/* ---------- Планшет: «в гостиной» уезжает в выдвижную панель ---------- */

@media (max-width: 1199px) {
  .lounge {
    grid-template-columns: var(--nav-w-tablet, 220px) minmax(0, 1fr);
    grid-template-areas:
      "top  top"
      "nav  stage";
  }
  .online-chip { display: inline-flex; }
  .online {
    position: fixed; z-index: 40; top: 0; right: 0; bottom: 0;
    width: min(320px, 86vw);
    border-radius: var(--radius) 0 0 var(--radius);
    transform: translateX(105%);
    transition: transform .22s ease;
    visibility: hidden;
  }
  .online-open .online { transform: none; visibility: visible; }
}

/* ---------- Телефон: меню тоже выдвижное ---------- */

@media (max-width: 767px) {
  :root { --gap: 8px; }
  .lounge {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "top"
      "stage";
    padding: 8px 8px 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .topbar { gap: 10px; min-height: 52px; }
  .topbar__nav { display: inline-grid; }
  .brand { gap: 8px; }
  .brand__crest { width: 34px; height: 34px; }
  .brand__title { font-size: 1.2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .brand > div { min-width: 0; }
  .brand__motto { display: none; }
  .online-chip { padding: 0 14px; }
  .online-chip__label { display: none; }

  .sidenav {
    position: fixed; z-index: 40; top: 0; left: 0; bottom: 0;
    width: min(300px, 84vw);
    border-radius: 0 var(--radius) var(--radius) 0;
    transform: translateX(-105%);
    transition: transform .22s ease;
    visibility: hidden;
  }
  .nav-open .sidenav { transform: none; visibility: visible; }

  .panel { border-radius: var(--radius) var(--radius) 0 0; }
  .panel__head { padding: 12px 14px 10px; }
  .panel__title { font-size: 1.3rem; }
  .panel__sub { display: none; }
  .feed { padding: 6px 4px 4px; }
  .msg { padding: 6px 8px; column-gap: 10px; grid-template-columns: 34px minmax(0, 1fr); }
  .msg .avatar { width: 34px; height: 34px; font-size: .85rem; }
  .msg--cont .msg__time--side { display: none; }
  .composer { padding: 8px; gap: 4px 8px; }
  .composer__hint { display: none; }
  .composer__send { padding: 0 14px; }
  .jump { bottom: 84px; }
}

/* ---------- Страницы-пороги: вход, нет доступа ---------- */

.gate-page {
  background: var(--gate-bg, var(--bg));
}
.gate {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center;
  padding: 24px 16px;
}
.gate__card {
  width: 100%; max-width: 400px;
  padding: 28px 26px 22px;
  border: 1px solid var(--line-strong); border-radius: 18px;
  background: var(--gate-card);
  box-shadow: var(--shadow-pop), 0 0 0 1px var(--metal-line);
  text-align: center;
}
.gate__crest {
  width: 72px; height: 72px; padding: 6px;
  border-radius: 50%; border: 1px solid var(--metal-line);
  background: var(--bg); object-fit: contain;
}
.gate__title { margin-top: 12px; font: 700 2rem/1.1 var(--font-serif); color: var(--heading); }
.gate__lead { margin-top: 8px; color: var(--text); }
.gate__error {
  margin-top: 16px; padding: 10px 12px; text-align: left;
  border-radius: var(--radius-sm);
  background: var(--danger-soft); box-shadow: inset 3px 0 0 var(--danger);
  font-size: .92rem;
}
.gate__form { display: grid; gap: 14px; margin-top: 20px; text-align: left; }
.field { display: grid; gap: 6px; }
.field__label { color: var(--text); font-size: .9rem; font-weight: 700; }
.field__input {
  min-height: 46px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--bg); color: var(--heading);
}
.field__input:focus { outline: none; border-color: var(--link); box-shadow: 0 0 0 3px var(--focus-ring); }
.gate__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 22px; }
.gate__links {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px;
  margin-top: 18px; font-size: .9rem;
}

/* ---------- Меньше движения ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Совсем узкие телефоны (iPhone SE и т. п.): герб уступает место названию */
@media (max-width: 379px) {
  .brand__crest { display: none; }
  .topbar { gap: 6px; }
  .brand__title { font-size: 1.1rem; }
  .icon-btn { width: 40px; height: 40px; }
  .online-chip { min-height: 40px; padding: 0 10px; }
}

/* ---------- События в ленте (плюшки темы) ---------- */

.msg--event {
  display: flex; align-items: baseline; justify-content: center; gap: 8px;
  margin: 10px 6px; padding: 8px 14px;
  border: 1px dashed var(--line-strong);
  background: var(--hover-faint);
  text-align: center;
}
.msg--event .msg__icon { flex: none; font-size: 1.05rem; font-style: normal; }
.msg--event .msg__body { margin: 0; color: var(--text); font-style: italic; white-space: normal; }
.msg--event .msg__time { flex: none; }
.msg--event .msg__go { flex: none; font-size: .82rem; }
.msg--for-me { border-style: solid; box-shadow: 0 0 0 1px var(--glow); }
.msg--event .msg__del { top: 50%; transform: translateY(-50%); }

/* ---------- Переключатель день/ночь ---------- */

.theme-btn { margin-left: auto; }
.theme-btn + .online-chip { margin-left: 0; }
.theme-btn__moon { display: none; }
[data-theme="day"] .theme-btn__sun { display: none; }
[data-theme="day"] .theme-btn__moon { display: inline; }
.theme-btn svg { color: var(--glow); }
[data-theme="day"] .theme-btn svg { color: var(--link); }

/* Плавная смена темы, только в момент переключения (класс ставит lounge.js) */
.theme-switching,
.theme-switching * {
  transition: background-color .5s ease, color .5s ease, border-color .5s ease, fill .5s ease !important;
}

/* Спокойная обстановка (Настройки): как системная настройка «меньше движения». */
html.is-calm *, html.is-calm *::before, html.is-calm *::after { animation: none !important; transition: none !important; }

/* Крупный текст чата (Настройки) */
[data-text="large"] .msg__body { font-size: 1.12rem; line-height: 1.55; }
[data-text="large"] .msg__nick { font-size: 1.05rem; }
[data-text="large"] .composer__input { font-size: 1.08rem; }

/* ---------- Привидение башни и личные строки ----------
   Цвета задаёт тема: --ghost-ink (имя), --ghost-text (реплика), --ghost-glow (свечение портрета). */

.avatar--ghost {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, var(--ghost-glow), transparent 75%);
  box-shadow: 0 0 0 1px var(--ghost-glow), 0 0 14px var(--ghost-glow);
  color: var(--ghost-ink);
}
.avatar--ghost svg { width: 24px; height: 24px; fill: currentColor; fill-opacity: .5; stroke: currentColor; stroke-width: 1.2; }
.avatar--ghost svg circle { fill: var(--bg); fill-opacity: .9; stroke: none; }
.avatar--ghost.avatar--sm { width: 30px; height: 30px; }
.avatar--ghost.avatar--sm svg { width: 20px; height: 20px; }
.avatar--ghost .avatar__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.msg--ghost .msg__nick { color: var(--ghost-ink); font-style: italic; letter-spacing: .02em; }
.msg--ghost .msg__body { color: var(--ghost-text); font-style: italic; }
.msg--ghost.msg--mention { box-shadow: inset 3px 0 0 var(--ghost-ink); }
.msg__to { flex: none; color: var(--text-dim); font-size: .82rem; }
.msg--ghost.msg--new { animation: none; }
.msg--ghost.msg--new .msg__body,
.msg--ghost.msg--new .msg__avatar { animation: ghost-in 1.4s ease-out both; }
@keyframes ghost-in {
  0%   { opacity: 0; filter: blur(3px); }
  60%  { opacity: .8; filter: blur(.5px); }
  100% { opacity: 1; filter: none; }
}

/* личная строка: видна только адресату */
.msg--private { background: var(--private-bg); box-shadow: inset 3px 0 0 var(--private-line); }
.msg__priv {
  flex: none;
  padding: 0 7px; border: 1px dashed var(--private-line); border-radius: 999px;
  color: var(--text-dim); font-size: .72rem; line-height: 1.5;
}

/* привидение первым в списке гостиной, под ним тонкая черта */
.guest--ghost .guest__name { color: var(--ghost-ink); font-style: italic; }
.guest--ghost .guest__status { color: var(--ghost-text); font-style: italic; }
.online__list > li:first-child:has(.guest--ghost) { padding-bottom: 4px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
