/* ==========================================================================
   Альт (ТБМ) — дизайн-система «Гранёный минерал»
   Фон — глубокая порода, камни-кланы — источник цвета, стекло — поверх.
   Все токены собраны в :root. Меняешь тут — меняется везде.
   ========================================================================== */

:root {
  /* Порода — почти чёрный, нейтральный. Не чистый #000: от него рябит на OLED. */
  --rock-900: #08090a;   /* фон приложения */
  --rock-800: #0f1113;   /* панели, карточки, модалки */
  --rock-700: #16181b;   /* поля ввода, пузыри сообщений */
  --rock-600: #1e2124;   /* кнопки, заглушки аватаров */
  --line:     #2a2e33;
  --line-soft:#1b1e21;

  --glass:      rgba(18, 20, 23, 0.62);
  --glass-line: rgba(255, 255, 255, 0.07);

  --text:  #f2f3f5;
  --muted: #9aa0a6;
  --faint: #61666c;

  /* Акцент — белый. Цвет в интерфейсе остаётся только у камней и у Прайма. */
  --accent:      #ffffff;
  --accent-2:    #e7e9eb;
  --accent-soft: rgba(255, 255, 255, 0.10);
  --accent-glow: rgba(255, 255, 255, 0.20);
  --accent-ink:  #0a0b0c;   /* текст на белой плашке */

  --mint: #d2d6da;   /* был зелёный — теперь светло-серый */
  --rose: #e5484d;   /* красный оставлен: единственный сигнал «удалить/жалоба» */
  --amber:#cfc9bd;   /* был жёлтый — теперь тёплый нейтральный */

  --r-xl: 26px;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;

  /* на чёрном фоне тени нужны глубже, иначе слои не читаются */
  --shadow:     0 28px 70px rgba(0, 0, 0, 0.72);
  --shadow-sm:  0 10px 28px rgba(0, 0, 0, 0.55);
  --glow-accent:0 0 0 1px rgba(255,255,255,0.14), 0 8px 30px rgba(255,255,255,0.10);

  --display: "Unbounded", ui-sans-serif, system-ui, sans-serif;
  --body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --nav-w: 248px;
  --rail-w: 320px;
}

[data-theme="light"] {
  --rock-900: #f4f5f6;
  --rock-800: #ffffff;
  --rock-700: #f0f1f3;
  --rock-600: #e7e9eb;
  --line:     #dcdfe3;
  --line-soft:#eceef0;
  --glass:      rgba(255, 255, 255, 0.72);
  --glass-line: rgba(10, 11, 12, 0.07);
  --text:  #0d0e10;
  --muted: #5f6469;
  --faint: #9aa0a6;
  --accent:      #101215;
  --accent-2:    #2a2e33;
  --accent-soft: rgba(16, 18, 21, 0.07);
  --accent-glow: rgba(16, 18, 21, 0.16);
  --accent-ink:  #ffffff;
  --mint: #5f6469;
  --amber:#5f6469;
  --shadow:    0 24px 60px rgba(10, 12, 14, 0.14);
  --shadow-sm: 0 8px 24px rgba(10, 12, 14, 0.09);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(130% 90% at 50% -20%, rgba(255, 255, 255, 0.05), transparent 60%),
    var(--rock-900);
  background-attachment: fixed;
  color: var(--text);
  font: 400 15px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 6px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: transparent; border-radius: 20px; border: 3px solid transparent; background-clip: content-box; }
:hover::-webkit-scrollbar-thumb { background: var(--line); }
* { scrollbar-width: thin; scrollbar-color: transparent transparent; }
*:hover { scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar-track { background: transparent; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }
.nowrap { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stone { display: block; filter: drop-shadow(0 2px 4px rgba(0,0,0,.35)); flex: none; }

/* --------------------------------------------------------------- бренд */
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 2px; }
.brand__gem { width: 30px; height: 30px; display: inline-flex; }
.brand__name {
  font: 800 23px/1 var(--display);
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, var(--text), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand--lg .brand__gem { width: 40px; height: 40px; }
.brand--lg .brand__name { font-size: 30px; }

/* --------------------------------------------------------------- кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent; border-radius: 999px;
  background: var(--rock-600);
  font: 600 14px/1 var(--body); cursor: pointer;
  transition: transform .12s ease, background .15s ease, border-color .15s, box-shadow .2s, opacity .15s;
}
.btn:hover { background: var(--line); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: var(--accent-2); box-shadow: var(--glow-accent); }
.btn--outline { background: transparent; border-color: var(--line); }
.btn--outline:hover { background: var(--rock-600); }
.btn--ghost { background: transparent; color: var(--muted); }
.btn--ghost:hover { background: var(--rock-600); color: var(--text); }
.btn--danger { background: transparent; border-color: rgba(255, 92, 124, .4); color: var(--rose); }
.btn--danger:hover { background: rgba(255, 92, 124, .12); }
.btn--full { width: 100%; }
.btn--sm { padding: 7px 13px; font-size: 13px; }
.btn--icon { padding: 9px; width: 38px; height: 38px; border-radius: 50%; }
.btn svg { width: 18px; height: 18px; }

/* --------------------------------------------------------------- поля */
.field { display: block; margin-bottom: 14px; }
.field__label { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 14px;
  background: var(--rock-700); border: 1px solid var(--line); border-radius: var(--r-md);
  transition: border-color .15s, background .15s;
}
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); background: var(--rock-800);
}
.field textarea { resize: vertical; min-height: 84px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form__hint { margin: 12px 0 0; font-size: 12.5px; color: var(--faint); }

/* --------------------------------------------------------------- вход */
.auth { position: relative; min-height: 100%; display: grid; place-items: center; padding: 40px 22px; }
.auth__aura {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40% 50% at 20% 25%, rgba(157,123,255,.28), transparent 70%),
    radial-gradient(35% 45% at 82% 70%, rgba(60,224,176,.16), transparent 70%),
    radial-gradient(30% 40% at 65% 15%, rgba(232,87,214,.14), transparent 70%);
  filter: blur(20px);
}
.auth__panel {
  width: 100%; max-width: 1040px;
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 54px; align-items: center;
}
.auth__title { margin: 24px 0 14px; font: 800 40px/1.08 var(--display); letter-spacing: -0.03em; }
.auth__lead { margin: 0 0 26px; max-width: 46ch; color: var(--muted); font-size: 15.5px; }
.auth__facts { display: flex; gap: 30px; }
.auth__facts b { display: block; font: 800 26px/1 var(--display); background: linear-gradient(120deg,#ffffff,var(--muted)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth__facts span { font-size: 12.5px; color: var(--faint); }
.auth__card {
  background: var(--glass); backdrop-filter: blur(24px) saturate(1.3);
  border: 1px solid var(--glass-line); border-radius: var(--r-xl);
  padding: 26px; box-shadow: var(--shadow);
}

/* табы */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; background: var(--rock-700); padding: 4px; border-radius: 999px; }
.tabs__btn { flex: 1; padding: 9px 14px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; transition: color .15s, background .15s; }
.tabs__btn.is-active { background: var(--rock-800); color: var(--text); }

/* выбор камня */
.stonepick { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; margin: 6px 0 4px; padding: 14px; background: var(--rock-700); border: 1px solid var(--line); border-radius: var(--r-lg); }
.stonepick__preview { width: 96px; height: 96px; display: grid; place-items: center; }
.stonepick__preview .stone { width: 88px; height: 88px; animation: gem-float 4s ease-in-out infinite; }
.stonepick__cols { display: grid; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.chip-btn { width: 34px; height: 34px; padding: 3px; border: 2px solid transparent; border-radius: 10px; background: var(--rock-600); cursor: pointer; display: grid; place-items: center; transition: border-color .15s, transform .1s; }
.chip-btn .stone { width: 26px; height: 26px; }
.chip-btn:hover { transform: translateY(-2px); }
.chip-btn.is-active { border-color: var(--accent); background: var(--accent-soft); }

@keyframes gem-float { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-6px) rotate(2deg); } }

/* --------------------------------------------------------------- каркас */
.app { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr) var(--rail-w); gap: 24px; max-width: 1280px; margin: 0 auto; padding: 0 20px; }
.rail.hidden { visibility: hidden; }
.app.app--wide .main { grid-column: 2 / 4; }
.app.app--wide .rail { display: none; }

.nav { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 8px; padding: 20px 0 18px; }
.nav__links { display: grid; gap: 3px; margin: 20px 0 14px; }
.nav__link {
  position: relative; display: flex; align-items: center; gap: 13px;
  padding: 12px 15px; border-radius: var(--r-md); color: var(--muted); font-weight: 500;
  transition: background .15s, color .15s;
}
.nav__link:hover { background: var(--rock-700); color: var(--text); }
.nav__link svg { width: 21px; height: 21px; flex: none; }
.nav__link.is-active { color: var(--text); background: var(--accent-soft); font-weight: 600; }
.nav__link.is-active::before { content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 22px; border-radius: 0 4px 4px 0; background: var(--accent); box-shadow: 0 0 10px var(--accent-glow); }
.nav__link .pill { margin-left: auto; min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font: 600 11.5px/18px var(--body); text-align: center; }
.nav__me { margin-top: auto; }
.nav__me button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px; border: 0; border-radius: var(--r-md); background: transparent; cursor: pointer; text-align: left; color: inherit; }
.nav__me button:hover { background: var(--rock-700); }
.nav__me button svg { width: 20px; height: 20px; flex: none; color: var(--muted); }

.main { min-width: 0; min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  min-height: 60px; padding: 0 18px;
  background: color-mix(in srgb, var(--rock-900) 78%, transparent);
  backdrop-filter: blur(16px); border-bottom: 1px solid var(--line-soft);
}
.topbar h1 { margin: 0; font: 700 18px/1.2 var(--display); letter-spacing: -.02em; }
.topbar .sub { font-size: 12.5px; color: var(--muted); }

.rail { position: sticky; top: 0; height: 100dvh; overflow-y: auto; padding: 20px 0; }
.rail__card { background: var(--glass); backdrop-filter: blur(16px); border: 1px solid var(--glass-line); border-radius: var(--r-lg); padding: 16px; margin-bottom: 16px; }
.rail__title { margin: 0 0 12px; font: 700 15px/1 var(--display); }
.rail-gear { float: right; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 0; }
.rail-gear:hover { color: var(--accent-2); }
.notif-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); align-self: center; }
.consent { display: flex; gap: 9px; align-items: flex-start; margin: 4px 0 14px; font-size: 13px; color: var(--muted); line-height: 1.45; cursor: pointer; }
.consent input { margin-top: 2px; width: 16px; height: 16px; flex: none; cursor: pointer; accent-color: var(--accent); }
.consent a { color: var(--accent-2); }

/* ===== Ответы на сообщения ===== */
.msg__actions { display: inline-flex; gap: 2px; align-self: center; opacity: .3; transition: opacity .15s; }
.msg:hover .msg__actions, .msg:focus-within .msg__actions { opacity: 1; }
.msg__act { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 8px; display: inline-flex; }
.msg__act:hover { background: var(--rock-700); color: var(--accent-2); }
.msg__act svg { width: 16px; height: 16px; }
.msg__reply { display: block; border-left: 2px solid var(--accent); padding: 2px 8px; margin-bottom: 4px; border-radius: 4px; background: var(--accent-soft); cursor: pointer; max-width: 100%; }
.msg__reply-author { display: block; font-size: 12px; font-weight: 700; color: var(--accent-2); }
.msg__reply-text { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.msg--flash .msg__bubble { animation: msg-flash 1.2s ease; }
@keyframes msg-flash { 0%, 100% { background: var(--rock-600); } 30% { background: var(--accent-soft); } }
/* панель ответа над полем ввода */
.reply-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 8px; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--rock-800); }
.reply-bar[hidden] { display: none !important; }
.reply-bar__icon { color: var(--accent); flex: none; }
.reply-bar__body { flex: 1; min-width: 0; }
.reply-bar__author { display: block; font-size: 12.5px; font-weight: 700; color: var(--accent-2); }
.reply-bar__text { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== Эмодзи-пикер ===== */

/* ===== Гиф-сетка ===== */

/* Цитата (репост с комментарием) */
.quoted { display: block; margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: inherit; background: var(--rock-800); transition: background .12s; }
.quoted:hover { background: var(--rock-700); }
.quoted__head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.quoted__name { font-weight: 600; font-size: 13.5px; }
.quoted__text { font-size: 14px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.quoted__media { margin-top: 5px; font-size: 12.5px; color: var(--faint); }
.quoted--deleted { color: var(--faint); font-size: 13px; font-style: italic; }
.repost-choice { display: flex; flex-direction: column; gap: 10px; }

/* Реакции на сообщения */
/* удалённый контент (виден автору/участнику/админу серым) */
.post--deleted { opacity: .55; }
.post--deleted .post__text { color: var(--muted); }
.post__deleted-tag, .msg--deleted .msg__text {
  font-size: 12px; color: var(--faint); font-style: italic;
}
.post__deleted-tag {
  display: inline-block; margin-bottom: 4px; padding: 1px 8px;
  border-radius: 999px; background: var(--rock-700); font-style: normal;
}
.msg--deleted .msg__bubble { background: transparent; border: 1px dashed var(--line); }
/* удалённые посты в админке — на всю ширину, а не столбиком */
[data-deleted] { display: block; width: 100%; }
[data-deleted] .post { width: 100%; box-sizing: border-box; }
[data-deleted] .post__body { min-width: 0; }

.tabbar {
  display: none; position: fixed; z-index: 40;
  bottom: calc(12px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  width: calc(100% - 24px); max-width: 460px;
  background: var(--glass); backdrop-filter: blur(22px) saturate(1.4);
  border: 1px solid var(--glass-line); border-radius: 22px; box-shadow: var(--shadow); padding: 6px;
}
.tabbar a { flex: 1; display: grid; place-items: center; gap: 3px; padding: 8px 0 7px; border-radius: 15px; color: var(--faint); font-size: 10px; font-weight: 600; transition: color .15s, background .15s; }
.tabbar a svg { width: 23px; height: 23px; }
.tabbar a.is-active { color: var(--accent-2); background: var(--accent-soft); }

/* --------------------------------------------------------------- аватар с рамкой-камнем */
.avatar { position: relative; flex: none; width: 42px; height: 42px; border-radius: 50%; overflow: hidden; background: var(--rock-600); display: grid; place-items: center; font: 700 15px/1 var(--display); color: #fff; user-select: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { width: 32px; height: 32px; font-size: 12px; }
.avatar--md { width: 48px; height: 48px; font-size: 17px; }
.avatar--lg { width: 88px; height: 88px; font-size: 30px; }
.avatar--sq { border-radius: 14px; }
/* Обёртка аватара с клановым кольцом и мини-камнем */
.ava { position: relative; flex: none; display: inline-grid; }
.ava__ring { position: absolute; inset: -3px; border-radius: 50%; padding: 2px; -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.ava__gem { position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; }
.ava__gem .stone { width: 18px; height: 18px; }
.ava--sq .ava__ring { border-radius: 14px; }
.dot-wrap { position: relative; flex: none; }
.dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: var(--faint); box-shadow: 0 0 0 2.5px var(--rock-900); }
.dot--on { background: #ffffff; }

/* --------------------------------------------------------------- посты */
.post { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 13px; padding: 17px 18px; border-bottom: 1px solid var(--line-soft); transition: background .12s; }
.post:hover { background: color-mix(in srgb, var(--rock-800) 45%, transparent); }
.post--single .post__text { font-size: 17px; }
/* Комментарии — компактнее и во всю ширину колонки */
.post--comment { grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding: 11px 18px; }
.post--comment .avatar { width: 34px; height: 34px; font-size: 13px; }
.post--comment .ava__gem { width: 15px; height: 15px; }
.post--comment .ava__gem .stone { width: 15px; height: 15px; }
.post--comment .post__text { font-size: 14px; margin-top: 2px; }
.post--comment .post__head { font-size: 13.5px; }
.post--comment .post__actions { margin-top: 6px; }
.post__flag { grid-column: 1 / -1; display: flex; align-items: center; gap: 7px; margin: -3px 0 5px; font-size: 12px; font-weight: 600; }
.post__flag .stone { width: 16px; height: 16px; }
.post__repost-label { grid-column: 1 / -1; display: flex; align-items: center; gap: 7px; margin: -2px 0 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.post__repost-label svg { width: 15px; height: 15px; color: var(--mint); }
.post__head { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; min-width: 0; }
.post__head > * { flex: none; }
.post__name { font-weight: 600; letter-spacing: -.01em; flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post__name:hover { text-decoration: underline; }
/* галочка верификации */
.verified-badge { display: inline-flex; align-items: center; vertical-align: middle; margin-left: 4px; width: 16px; height: 16px; background: var(--accent); color: var(--accent-ink); border-radius: 50%; padding: 2px; }
.verified-badge svg { width: 12px; height: 12px; stroke-width: 3; }
.post__handle, .post__time { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post__handle { flex: 0 1 auto; min-width: 0; }
.post__menu { margin-left: auto; flex: none; padding: 4px; opacity: .55; }
.post__menu + .post__menu { margin-left: 0; }
.post__menu:hover { opacity: 1; }
.post__menu svg { width: 15px; height: 15px; }
.post__text { margin: 3px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.post__media { display: grid; gap: 4px; margin-top: 11px; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); }
.post__media--2, .post__media--3, .post__media--4 { grid-template-columns: 1fr 1fr; }
.post__media img { width: 100%; height: 100%; max-height: 420px; object-fit: cover; cursor: zoom-in; }
.post__actions { display: flex; gap: 2px; margin-top: 10px; margin-left: -8px; align-items: center; }
.action { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 13px; cursor: pointer; transition: color .14s, background .14s; }
.action svg { width: 17px; height: 17px; }
.action:hover { background: var(--accent-soft); color: var(--accent-2); }
.action--like:hover { background: rgba(255,92,124,.12); color: var(--rose); }
.action--like.is-on { color: var(--rose); }
.action--like.is-on svg { fill: var(--rose); }
.action--repost:hover { background: var(--accent-soft); color: var(--text); }
.action--repost.is-on { color: var(--text); }
.action--del:hover { background: rgba(255,92,124,.12); color: var(--rose); }
/* Кнопка-камень «захватить» */
.action--stone { margin-left: auto; padding: 5px; }
.action--stone .stone { width: 22px; height: 22px; transition: transform .15s; }
.action--stone:hover .stone { transform: scale(1.15) rotate(8deg); }
.action--stone.is-on { background: var(--accent-soft); }
.action--stone.is-placed { cursor: default; opacity: .85; }
.action--stone.is-placed:hover .stone { transform: none; }
.action--stone[disabled] { cursor: default; }
.stone-tally { display: inline-flex; align-items: center; gap: -4px; margin-left: 4px; }
.stone-tally .stone { width: 15px; height: 15px; margin-left: -4px; }
.stone-count { font-size: 12px; color: var(--muted); margin-left: 6px; }

/* редактор поста */
.composer { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 13px; padding: 17px 18px; border-bottom: 1px solid var(--line); }
.composer textarea { width: 100%; min-height: 54px; padding: 8px 0; border: 0; background: transparent; font-size: 17px; resize: none; }
.composer textarea:focus { outline: none; }
.composer textarea::placeholder { color: var(--faint); }
.composer__foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.composer__count { font-size: 12.5px; color: var(--faint); }
.previews { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.previews:empty { display: none; margin: 0; }
.preview { position: relative; width: 84px; height: 84px; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line); }
.preview img { width: 100%; height: 100%; object-fit: cover; }
.preview button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; }
.preview button svg { width: 13px; height: 13px; }

/* сегменты */
.segmented { display: flex; border-bottom: 1px solid var(--line); position: sticky; top: 60px; background: color-mix(in srgb, var(--rock-900) 78%, transparent); backdrop-filter: blur(12px); z-index: 10; }
.segmented button { flex: 1; position: relative; padding: 14px 8px; border: 0; background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; }
.segmented button:hover { background: var(--line-soft); color: var(--text); }
.segmented button.is-active { color: var(--text); }
.segmented button.is-active::after { content: ""; position: absolute; bottom: -1px; left: 50%; transform: translateX(-50%); width: 46px; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); box-shadow: 0 0 10px var(--accent-glow); }

/* --------------------------------------------------------------- профиль */
.profile__cover { height: 130px; background: radial-gradient(120% 160% at 15% 0%, var(--accent-soft), transparent 60%), var(--rock-700); position: relative; overflow: hidden; }
.profile__cover .stone { position: absolute; right: -10px; top: -20px; width: 160px; height: 160px; opacity: .18; }
.profile__banner { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.profile__head { padding: 0 18px 16px; border-bottom: 1px solid var(--line-soft); }
.profile__top { display: flex; align-items: flex-end; gap: 14px; margin-top: -42px; }
.profile__name { margin: 12px 0 0; font: 700 21px/1.2 var(--display); letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile__handle { color: var(--muted); font-size: 14px; }
.profile__clan { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px 4px 5px; border-radius: 999px; background: var(--rock-700); border: 1px solid var(--line); font-size: 13px; font-weight: 600; cursor: pointer; }
.profile__clan .stone { width: 20px; height: 20px; }
.profile__bio { margin: 11px 0 0; white-space: pre-wrap; }
.counters { display: flex; gap: 18px; margin-top: 13px; font-size: 14px; flex-wrap: wrap; }
.counters b { font-weight: 700; }
.counters span { color: var(--muted); }

/* --------------------------------------------------------------- списки людей */
.userrow { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line-soft); }
.userrow:hover { background: color-mix(in srgb, var(--rock-800) 45%, transparent); }
.userrow__body { min-width: 0; flex: 1; }
.userrow__name { font-weight: 600; }
.userrow__sub { font-size: 13px; color: var(--muted); }
.rail .userrow { padding: 9px 0; border: 0; }

/* --------------------------------------------------------------- кланы / рейтинг */
.ladder { display: grid; gap: 10px; padding: 16px 18px; }
.ladder__row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--glass); border: 1px solid var(--glass-line); border-radius: var(--r-lg); position: relative; overflow: hidden; }
.ladder__row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--clan, var(--accent)); }
.ladder__rank { font: 800 22px/1 var(--display); width: 34px; text-align: center; color: var(--faint); }
.ladder__row:nth-child(1) .ladder__rank { color: #ffd23f; }
.ladder__row:nth-child(2) .ladder__rank { color: #cfd3e0; }
.ladder__row:nth-child(3) .ladder__rank { color: #e08b52; }
.ladder__gem { width: 46px; height: 46px; display: grid; place-items: center; }
.ladder__gem .stone { width: 46px; height: 46px; }
.ladder__body { flex: 1; min-width: 0; }
.ladder__name { font-weight: 700; }
.ladder__meta { font-size: 12.5px; color: var(--muted); }
.ladder__pts { text-align: right; }
.ladder__pts b { font: 800 20px/1 var(--display); color: var(--clan, var(--accent-2)); }
.ladder__pts span { display: block; font-size: 11px; color: var(--faint); margin-top: 3px; }
.clan-hero { padding: 26px 18px; text-align: center; border-bottom: 1px solid var(--line-soft); }
.clan-hero .stone { width: 120px; height: 120px; margin: 0 auto 14px; animation: gem-float 5s ease-in-out infinite; }
.clan-hero h1 { margin: 0 0 6px; font: 800 26px/1.1 var(--display); }
.clan-hero .clan-stats { display: flex; justify-content: center; gap: 26px; margin-top: 16px; }
.clan-hero .clan-stats b { display: block; font: 800 22px/1 var(--display); color: var(--accent-2); }
.clan-hero .clan-stats span { font-size: 12px; color: var(--muted); }

/* мини-виджет рейтинга в правой колонке */
.mini-ladder { display: grid; gap: 8px; }
.mini-ladder a { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--r-sm); }
.mini-ladder a:hover { background: var(--rock-700); }
.mini-ladder .stone { width: 26px; height: 26px; }
.mini-ladder .r { font: 800 14px/1 var(--display); color: var(--faint); width: 16px; }
.mini-ladder .nm { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; }
.mini-ladder .pt { font-size: 12.5px; color: var(--accent-2); font-weight: 700; }

/* --------------------------------------------------------------- чаты */
.chatpane { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: calc(100dvh - 60px); }
/* Режим чата: страница зафиксирована по высоте экрана, скроллится только переписка */
body.chat-mode { overflow: hidden; }
body.chat-mode .app { height: 100dvh; max-height: 100dvh; overflow: hidden; }
body.chat-mode .main { min-height: 0; height: 100dvh; max-height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
body.chat-mode .topbar { flex: none; }
body.chat-mode #view { flex: 1; min-height: 0; overflow: hidden; }
body.chat-mode .chatpane { height: 100%; min-height: 0; }
body.chat-mode .conv { min-height: 0; height: 100%; overflow: hidden; }
body.chat-mode .conv__body { min-height: 0; overflow-y: auto; }
body.chat-mode .dialogs { min-height: 0; overflow: hidden; }
.dialogs { border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; min-width: 0; }
.dialogs__search { padding: 12px; border-bottom: 1px solid var(--line-soft); }
.dialogs__search input { width: 100%; padding: 10px 15px; background: var(--rock-700); border: 1px solid transparent; border-radius: 999px; }
.dialogs__search input:focus { outline: none; border-color: var(--accent); background: var(--rock-800); }
.dialogs__list { flex: 1; overflow-y: auto; }
.dialog { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 15px; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; cursor: pointer; text-align: left; }
.dialog:hover { background: var(--rock-700); }
.dialog.is-active { background: var(--accent-soft); }
.dialog__body { flex: 1; min-width: 0; }
.dialog__top { display: flex; align-items: baseline; gap: 8px; }
.dialog__title { font-weight: 600; flex: 1; min-width: 0; }
.dialog__time { font-size: 11.5px; color: var(--faint); flex: none; }
.dialog__last { font-size: 13px; color: var(--muted); }
.badge { min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font: 600 11.5px/18px var(--body); text-align: center; flex: none; }

.conv { display: flex; flex-direction: column; min-width: 0; background: color-mix(in srgb, var(--rock-800) 40%, transparent); }
.conv__head { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line-soft); }
.conv__head .btn--icon { position: relative; }
.req-dot { position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--rose); color: #fff; font: 700 10px/16px var(--body); text-align: center; }
.conv__title { font-weight: 600; }
.conv__sub { font-size: 12.5px; color: var(--muted); }
.conv__body { flex: 1; overflow-y: auto; }
.conv__scroll { max-width: 780px; margin: 0 auto; padding: 20px 20px 8px; display: flex; flex-direction: column; gap: 3px; min-height: 100%; }
.conv__foot { border-top: 1px solid var(--line-soft); padding: 10px 18px calc(10px + env(safe-area-inset-bottom)); flex: none; }
.sendbox { display: flex; align-items: flex-end; gap: 10px; max-width: 780px; margin: 0 auto; }
.sendbox textarea { flex: 1; max-height: 150px; padding: 12px 17px; background: var(--rock-600); border: 0; border-radius: 22px; font-size: 16px; line-height: 1.45; resize: none; overflow-y: auto; display: block; }
.sendbox textarea:focus { outline: none; box-shadow: 0 0 0 1px rgba(255, 255, 255, .16); }
.sendbox .btn--icon { flex: none; }
.conv__foot .previews { max-width: 780px; margin: 8px auto 0; }
.conv__foot .reply-bar { max-width: 780px; margin: 0 auto 8px; }

.msg { display: flex; gap: 9px; max-width: 68%; align-items: flex-end; }
.msg--mine { align-self: flex-end; flex-direction: row-reverse; }
.msg__bubble {
  padding: 7px 11px 6px;
  background: var(--rock-700); border: 1px solid var(--line);
  border-radius: 16px 16px 16px 5px;
  overflow-wrap: anywhere; line-height: 1.38; font-size: 14.5px;
  width: fit-content; max-width: 100%;
}
.msg--mine .msg__bubble { background: var(--accent); border-color: transparent; color: var(--accent-ink); border-radius: 16px 16px 5px 16px; }
/* текст и время в одной строке снизу; текст переносится, время прижато вправо */
.msg__text { white-space: pre-wrap; }
.msg__author { display: block; margin-bottom: 2px; font: 600 12.5px/1.3 var(--body); color: var(--accent-2); }
.msg__meta { float: right; margin: 6px 0 0 12px; font-size: 10.5px; opacity: .6; user-select: none; }
.msg__img { margin: -1px -5px 6px; border-radius: 12px; overflow: hidden; }
.msg__img img { max-height: 340px; object-fit: cover; cursor: zoom-in; }
.msg__del { flex: none; border: 0; background: transparent; color: var(--faint); cursor: pointer; opacity: .3; transition: opacity .15s; padding: 4px; }
.msg:hover .msg__del { opacity: 1; }
.msg__del svg { width: 15px; height: 15px; }
.daysep { align-self: center; margin: 14px 0 8px; padding: 3px 12px; font-size: 11.5px; color: var(--muted); background: var(--rock-700); border-radius: 999px; }
.typing { max-width: 780px; margin: 0 auto; width: 100%; padding: 2px 20px 6px; font-size: 12.5px; color: var(--muted); min-height: 20px; }
.typing:empty { display: none; }

.members { display: grid; gap: 2px; }
.member { display: flex; align-items: center; gap: 10px; padding: 8px 4px; }
.role { padding: 2px 8px; border-radius: 999px; font: 600 11px/16px var(--body); background: var(--rock-700); color: var(--muted); }
.role--owner { background: var(--accent-soft); color: var(--text); }
.role--admin { background: var(--accent-soft); color: var(--accent-2); }

/* каналы */
.channel-card { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.channel-card__body { flex: 1; min-width: 0; }
.channel-card__title { font-weight: 600; }
.channel-card__sub { font-size: 13px; color: var(--muted); }

/* --------------------------------------------------------------- админка */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding: 18px; }
.stat { padding: 16px; background: var(--glass); border: 1px solid var(--glass-line); border-radius: var(--r-md); }
.stat__n { font: 800 26px/1.1 var(--display); letter-spacing: -.03em; }
.stat__l { margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.stat--accent .stat__n { color: var(--accent-2); }
.stat--mint .stat__n { color: var(--mint); }
.stat--rose .stat__n { color: var(--rose); }
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font: 600 11px/17px var(--body); }
.chip--ban { background: rgba(255,92,124,.14); color: var(--rose); }
.chip--mute { background: var(--accent-soft); color: var(--text); }
.chip--admin { background: var(--accent-soft); color: var(--accent-2); }
.chip--mod { background: rgba(120,200,255,.15); color: #9fd0ff; }
.chip--verified { background: rgba(157,123,255,.18); color: var(--accent-2); }
.chip--premium { background: rgba(210,190,255,.16); color: #e8d6ff; }
/* сегменты выбора роли */
.seg-roles { display: flex; gap: 6px; }
.seg-roles button { flex: 1; padding: 8px; border: 1px solid var(--line); background: var(--rock-700); color: var(--text); border-radius: 10px; cursor: pointer; font-size: 13px; transition: background .12s, border-color .12s; }
.seg-roles button.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); font-weight: 600; }
.seg-roles button:hover { border-color: var(--accent); }

/* Жалобы / модерация */
.action--report { color: var(--muted); }
.action--report:hover { color: var(--rose); }
.rep { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 0 18px 12px; background: var(--rock-800); }
.rep__head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.chip--type { background: var(--rock-700); color: var(--muted); padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.rep__body { font-size: 14px; }
.rep__text { color: var(--muted); margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.rep__reason { margin-top: 8px; font-size: 13px; color: var(--amber); }
.rep__from { margin-top: 6px; font-size: 12px; }
.rep__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.rep__actions .spacer { flex: 1; }

/* Тех-окно (режим техработ) */
#maintenance { position: fixed; inset: 0; z-index: 9999; display: none; align-items: center; justify-content: center; background: var(--rock-900); padding: 24px; }
.maint__box { text-align: center; max-width: 420px; }
.maint__box h1 { font-family: var(--font-display, inherit); font-size: 26px; margin: 18px 0 10px; }
.maint__box p { color: var(--muted); font-size: 15px; line-height: 1.6; }
.maint__gem { width: 72px; height: 72px; margin: 0 auto; border-radius: 20px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); animation: gem-float 4s ease-in-out infinite; }

/* Плашка новостей над лентой */
.news-banner { display: flex; align-items: center; gap: 8px; margin: 12px 14px 4px; padding: 10px 12px; border-radius: 14px; background: var(--accent-soft); border: 1px solid var(--accent); }
.news-banner__main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-decoration: none; color: var(--accent-2); font-weight: 600; font-size: 14px; }
.news-banner__main svg { width: 18px; height: 18px; flex: none; }
.news-banner__title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.news-banner__close { border: 0; background: transparent; color: var(--accent-2); cursor: pointer; padding: 4px; border-radius: 8px; flex: none; }
.news-banner__close:hover { background: rgba(157,123,255,.2); }
/* Страница новости */
.news-page { padding: 20px 18px 40px; max-width: 680px; }
.news-page__back { color: var(--accent); text-decoration: none; font-size: 14px; }
.news-page__title { font-family: var(--font-display, inherit); font-size: 24px; margin: 14px 0 6px; }
.news-page__date { font-size: 13px; margin-bottom: 16px; }
.news-page__body { font-size: 15px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.news-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.news-row:last-child { border-bottom: 0; }

/* ===== Премиум-камень «Прайм Нова»: живой перелив + пульсирующее свечение ===== */
.stone--premium { animation: pn-glow 2.6s ease-in-out infinite; }
.stone--premium .pn-flow {
  fill: #ffffff;
  background: linear-gradient(115deg, #fff, #ffd6f2, #d6e0ff, #d0fff0, #fff);
}
/* градиент через SVG-совместимый способ: заливаем анимированным паттерном */
.pn-flow { fill: url(#pn-grad-a); }
.pn-sheen { fill: url(#pn-grad-b); mix-blend-mode: screen; opacity: .7; }
.stone--premium svg .pn-flow { animation: pn-slide 3.5s linear infinite; }
.stone--premium svg .pn-sheen { animation: pn-slide2 5s linear infinite; }
@keyframes pn-slide  { from { transform: translateX(-40px); } to { transform: translateX(40px); } }
@keyframes pn-slide2 { from { transform: translateX(45px); }  to { transform: translateX(-45px); } }
@keyframes pn-glow {
  0%,100% { filter: drop-shadow(0 0 3px rgba(210,190,255,.5)); }
  50%     { filter: drop-shadow(0 0 9px rgba(220,200,255,.95)); }
}

/* выделение поста автора с Прайм Новой в ленте */
.post--premium {
  background: linear-gradient(90deg, rgba(190,150,255,.07), transparent 70%);
  border-left: 2px solid transparent;
  border-image: linear-gradient(180deg, #d6b0ff, #a0d0ff, #b0ffe0) 1;
}
/* бейдж «Прайм Нова» рядом с именем автора */
.pn-badge {
  display: inline-flex; align-items: center; gap: 3px; vertical-align: middle;
  margin-left: 6px; padding: 1px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
  color: #f0e6ff; background: linear-gradient(90deg, rgba(214,176,255,.25), rgba(160,208,255,.25));
  border: 1px solid rgba(214,176,255,.4);
}
.chip--ok { background: var(--accent-soft); color: var(--text); }
.adm-list { display: grid; gap: 10px; padding: 16px 18px 28px; }
.adm-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--glass); border: 1px solid var(--glass-line); border-radius: var(--r-md); }
.adm-card__body { flex: 1; min-width: 0; }
.adm-card__name { font-weight: 600; }
.adm-card__name .muted { font-weight: 400; font-size: 13px; }
.adm-card__sub { font-size: 13px; color: var(--muted); margin: 1px 0 6px; }
.adm-card__chips { display: flex; gap: 5px; flex-wrap: wrap; }
.adm-card__stats { display: flex; gap: 18px; flex: none; font-size: 12.5px; color: var(--muted); }
.adm-card__stats b { display: block; font: 700 16px/1.2 var(--display); color: var(--text); }
.adm-card__stats span { text-align: center; }
.adm-info { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.adm-info__name { font: 700 19px/1.2 var(--display); }
.adm-info__chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.adm-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: var(--r-md); overflow: hidden; margin-bottom: 16px; }
.adm-facts > div { display: flex; justify-content: space-between; gap: 10px; padding: 10px 13px; background: var(--rock-800); font-size: 13px; }
.adm-facts span { color: var(--muted); flex: none; }
.adm-facts b { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.adm-actions { display: grid; gap: 8px; }
.adm-actions .btn { justify-content: flex-start; }

/* --------------------------------------------------------------- модальные */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 18px; background: rgba(0, 0, 0, .72); backdrop-filter: blur(8px); animation: fade .16s ease; }
.modal__box { width: 100%; max-width: 520px; max-height: 88dvh; overflow-y: auto; background: var(--rock-800); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow); animation: pop .18s ease; }
.modal__head { position: sticky; top: 0; display: flex; align-items: center; gap: 10px; padding: 15px 18px; background: var(--rock-800); border-bottom: 1px solid var(--line-soft); }
.modal__head h2 { margin: 0; font: 700 17px/1.2 var(--display); flex: 1; }
.modal__body { padding: 18px; }
.modal--wide .modal__box { max-width: 760px; }
.modal--image { background: rgba(8,5,18,.9); }
.modal--image img { max-width: 92vw; max-height: 88dvh; border-radius: var(--r-md); object-fit: contain; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* тосты */
.toasts { position: fixed; z-index: 80; bottom: 22px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; }
.toast { padding: 11px 17px; background: var(--rock-700); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-sm); font-size: 14px; animation: pop .18s ease; }
.toast--err { border-color: rgba(255,92,124,.5); color: var(--rose); }
.toast--ok { border-color: rgba(255,255,255,.35); color: var(--text); }
.toast--capture { border-color: var(--accent); color: var(--accent-2); font-weight: 600; }

/* прочее */
.empty { padding: 54px 24px; text-align: center; color: var(--muted); }
.empty h3 { margin: 0 0 6px; font: 700 17px/1.3 var(--display); color: var(--text); }
.empty p { margin: 0 auto; max-width: 34ch; font-size: 14px; }
.loader { padding: 30px; text-align: center; color: var(--faint); font-size: 13.5px; }
.divider { height: 1px; background: var(--line-soft); }
.section-title { padding: 14px 18px 6px; font: 700 14px/1 var(--display); color: var(--muted); }

/* --------------------------------------------------------------- адаптив */
/* шапка списка диалогов: поиск + кнопки */
.dialogs__head { display: flex; align-items: center; gap: 6px; padding: 12px; }
.dialogs__head input { flex: 1; min-width: 0; padding: 9px 14px; background: var(--rock-700); border: 1px solid var(--line); border-radius: 999px; }
.dialogs__head .btn--icon { flex: none; }
/* поиск в верхней панели */
.topbar__search svg { width: 20px; height: 20px; }
/* точка-бэйдж в мобильном баре */
.tabbar a { position: relative; }
.tab-dot { position: absolute; top: 5px; right: 50%; transform: translateX(14px); width: 8px; height: 8px; border-radius: 50%; background: var(--rose); }
/* кнопка админки — только когда нет левого меню (мобильный) */
.nav-only-mobile { display: none; }
.mobile-rail { display: none; }
.mobile-rail .rail__card { margin-bottom: 12px; }

@media (max-width: 1120px) {
  .app { grid-template-columns: var(--nav-w) minmax(0, 1fr); }
  .rail { display: none; }
  .app.app--wide .main { grid-column: 2; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0; }
  .app.app--wide .main { grid-column: 1; }
  .nav { display: none; }
  .main { border: 0; padding-bottom: 88px; grid-column: 1; }
  .tabbar { display: flex; }
  .chatpane { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - 60px); }
  /* в открытом чате нижний бар скрыт — значит и запас под него не нужен */
  body.chat-mode .main { padding-bottom: 0; }
  .chatpane .conv { display: none; }
  .chatpane.is-open .dialogs { display: none; }
  .chatpane.is-open .conv { display: flex; }
  body:has(.chatpane.is-open) .tabbar { display: none; }
  .msg { max-width: 86%; }
  .auth__panel { grid-template-columns: minmax(0, 1fr); gap: 30px; }
  .auth__title { font-size: 31px; }
  .segmented { top: 60px; }
  .nav-only-mobile { display: flex; }
  .mobile-rail { display: block; margin-bottom: 4px; }
}
/* ===== Плавность интерфейса ===== */
/* мягкое появление контента при переключении разделов */
#view { animation: view-in .22s ease; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* появление новых сообщений (только свежепришедших, не при загрузке истории) */
.msg--new { animation: msg-in .2s ease; }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* появление постов — только помеченных новыми (свежая публикация) */
.post--new { animation: post-in .24s ease; }
@keyframes post-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
/* плавность модалок и всплывашек */
.modal__box { animation: modal-in .2s cubic-bezier(.2,.8,.3,1); }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
.toast { animation: toast-in .25s cubic-bezier(.2,.8,.3,1); }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
/* мягкие переходы на интерактивных элементах */
.btn, .action, .nav__link, .tabbar a, .dialog { transition: background .15s ease, color .15s ease, transform .1s ease, border-color .15s ease, opacity .15s ease; }
.btn:active, .action:active { transform: scale(.95); }

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

/* ============================================================ уровни доступа */
.plans-head { padding: 26px 18px 18px; text-align: center; }
.plans-title { font: 800 27px/1.15 var(--display); margin: 0 0 8px; letter-spacing: -.02em; }
.plans-sub { margin: 0; color: var(--muted); font-size: 14.5px; }
.plans-notice {
  margin: 0 18px 18px; padding: 13px 16px;
  background: var(--accent-soft); border: 1px solid var(--glass-line);
  border-radius: var(--r-md); font-size: 13.5px; line-height: 1.5;
}
.plans {
  display: grid; gap: 14px; padding: 0 18px 18px; align-items: start;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.plan {
  position: relative; display: flex; flex-direction: column;
  padding: 22px 20px; border-radius: var(--r-xl);
  background: var(--glass); backdrop-filter: blur(16px);
  border: 1px solid var(--glass-line);
}
/* средний уровень — визуальный центр экрана */
.plan--hot {
  border-color: rgba(255, 255, 255, .22);
  background: linear-gradient(180deg, rgba(255,255,255,.07), var(--glass));
  box-shadow: var(--shadow-sm);
}
.plan--owned { border-color: rgba(255,255,255,.3); }
.plan__badge {
  position: absolute; top: -11px; left: 20px;
  padding: 4px 11px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font: 700 11px/1.3 var(--body); letter-spacing: .02em; text-transform: uppercase;
}
.plan__badge--owned { background: var(--rock-600); color: var(--text); }
.plan__name { margin: 4px 0 10px; font: 700 19px/1 var(--display); }
.plan__price { font: 800 40px/1 var(--display); letter-spacing: -.03em; }
.plan__price span { font-size: 20px; margin-left: 4px; color: var(--muted); }
.plan__note { margin-top: 5px; font-size: 12.5px; color: var(--faint); }
.plan__pitch { margin: 14px 0 16px; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.plan__list { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 9px; flex: 1; }
.plan__list li { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; line-height: 1.45; }
.plan__list svg { width: 15px; height: 15px; flex: none; margin-top: 2px; }
.plan__list li.is-off { color: var(--faint); }
.plan__dash { width: 15px; flex: none; text-align: center; }

.plans-extra {
  display: grid; gap: 12px; padding: 0 18px 18px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.plans-extra .rail__card { margin: 0; }
.plans-foot { padding: 0 18px 40px; text-align: center; }

.pay-info {
  margin-top: 4px; padding: 13px 15px; border-radius: var(--r-md);
  background: var(--rock-700); border: 1px solid var(--line);
  font-size: 13.5px; line-height: 1.55; white-space: pre-wrap;
}

/* админка: заявки и коды */
.payreq {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px;
}
.payreq:last-child { border-bottom: 0; }
.codes { display: flex; flex-wrap: wrap; gap: 6px; }
.code-chip {
  padding: 6px 11px; border-radius: var(--r-sm);
  background: var(--rock-700); border: 1px solid var(--line);
  font: 600 13px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  user-select: all;
}

/* приглашения */
.ref-now { display: flex; gap: 18px; margin: 0 0 12px; }
.ref-now div { display: flex; flex-direction: column; }
.ref-now b { font: 800 22px/1 var(--display); letter-spacing: -.02em; }
.ref-now span { font-size: 11.5px; color: var(--faint); margin-top: 3px; }
.ref-log { margin-top: 12px; border-top: 1px solid var(--line-soft); padding-top: 10px; display: grid; gap: 6px; }
.ref-log div { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.ref-log b { margin-left: auto; }

/* ============================================ выделение текста
   Раньше протаскивание мышью выделяло половину интерфейса вместе с
   кнопками и подписями. Теперь выделяется только то, что имеет смысл
   скопировать: текст сообщений, постов, комментариев и поля ввода. */
body {
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
input, textarea, select,
.msg__text, .msg__reply-text,
.post__text, .quoted__text,
.news-page__body, .pay-info, .code-chip,
.profile__bio, .comment-text,
[data-selectable] {
  -webkit-user-select: text; user-select: text;
}

/* ============================================ ввод на телефоне
   Шрифт в полях меньше 16px заставляет iOS увеличивать страницу при
   фокусе — потом её приходится сводить пальцами обратно. */
@media (max-width: 860px) {
  input, textarea, select, .sendbox textarea { font-size: 16px; }
}

/* Высота переписки считается по реально видимой части экрана: когда на
   телефоне открыта клавиатура, строка ввода остаётся над ней, а не под. */
@media (max-width: 860px) {
  .chatpane { height: calc(var(--vvh, 100dvh) - 60px); }
  body.chat-mode .main { height: var(--vvh, 100dvh); max-height: var(--vvh, 100dvh); }
}

/* выбор срока подписки */
.periods { display: grid; gap: 8px; margin-bottom: 16px; }
.period {
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  gap: 2px 12px; text-align: left;
  padding: 12px 15px; border-radius: var(--r-md);
  background: var(--rock-700); border: 1px solid var(--line);
  color: inherit; cursor: pointer; transition: border-color .15s, background .15s;
}
.period:hover { border-color: var(--line); background: var(--rock-600); }
.period.is-on { border-color: rgba(255,255,255,.4); background: var(--rock-600); }
.period__len { grid-column: 1; font-weight: 600; font-size: 14.5px; }
.period__mo { grid-column: 1; font-size: 12.5px; color: var(--muted); }
.period__sum {
  grid-column: 2; grid-row: 1; justify-self: end;
  font-weight: 700; font-size: 15px; white-space: nowrap;
}
.period__off {
  grid-column: 2; justify-self: end;
  padding: 2px 8px; border-radius: 999px;
  background: #fff; color: var(--accent-ink);
  font: 700 11px/1.4 var(--body); white-space: nowrap;
}
/* в наборах искр строк всего две — плашка бонуса встаёт под суммой */
.period:not(:has(.period__mo)) .period__off { grid-row: 2; }
.plan__from { margin-top: 5px; font-size: 12.5px; color: var(--muted); }

/* кнопка удаления рядом с кодом доступа */
.code-chip button {
  margin-left: 7px; padding: 0 2px; border: 0; background: transparent;
  color: var(--faint); font-size: 15px; line-height: 1; cursor: pointer;
}
.code-chip button:hover { color: var(--rose); }

/* статистика автора */
.stat-head {
  display: flex; gap: 26px; padding: 18px 20px;
  background: var(--glass); backdrop-filter: blur(14px);
  border: 1px solid var(--glass-line); border-radius: var(--r-xl);
}
.stat-head div { display: flex; flex-direction: column; }
.stat-head b { font: 800 26px/1 var(--display); letter-spacing: -.02em; }
.stat-head span { margin-top: 4px; font-size: 12px; color: var(--faint); }
.stat-grid { display: grid; gap: 14px 10px; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); }
.stat-grid div { display: flex; flex-direction: column; }
.stat-grid b { font: 700 19px/1 var(--display); }
.stat-grid span { margin-top: 3px; font-size: 11.5px; color: var(--faint); }
.stat-list { display: grid; gap: 9px; }
.stat-list div { display: flex; gap: 12px; align-items: baseline; font-size: 13.5px; }
.stat-list div span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-list div b { flex: none; }

/* итоговая сумма в окне оформления */
.pay-total { margin: 4px 0 2px; font-size: 14px; }
.pay-total b { font: 700 17px/1 var(--display); margin: 0 4px; }
.pay-total s { margin-left: 6px; font-size: 13px; }
.pay-total__off {
  margin-left: 8px; padding: 2px 8px; border-radius: 999px;
  background: #fff; color: var(--accent-ink); font: 700 11px/1.5 var(--body);
}

/* сезон кланов */
.season {
  padding: 18px 20px; border-radius: var(--r-xl);
  background: var(--glass); backdrop-filter: blur(14px);
  border: 1px solid var(--glass-line);
}
.season__head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.season__head > div:first-child { flex: 1; min-width: 0; }
.season__title { font: 700 18px/1.2 var(--display); }
.season__sub { margin-top: 4px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.season__place { flex: none; text-align: center; }
.season__place b { display: block; font: 800 24px/1 var(--display); }
.season__place span { font-size: 11px; color: var(--faint); }
.season__table, .season__leaders { display: grid; gap: 7px; }
.season__leaders { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.season__table div, .season__leaders div {
  display: flex; align-items: center; gap: 9px; font-size: 13.5px;
}
.season__table b, .season__leaders b { margin-left: auto; }
.season__table .is-mine, .season__leaders .is-mine { color: #fff; font-weight: 600; }
.season__dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* строка-ссылка в настройках */
.settings-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line-soft);
  color: inherit; text-decoration: none; font-size: 14px;
}
.settings-row:last-child { border-bottom: 0; }
.settings-row b { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; }
.settings-row b svg { width: 16px; height: 16px; }
.settings-row:hover b { color: var(--text); }

/* экран подписки: одна карточка + что бесплатно */
.sub {
  display: grid; gap: 14px; padding: 0 18px 18px; align-items: start;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.sub__main {
  padding: 24px 22px; border-radius: var(--r-xl);
  background: linear-gradient(180deg, rgba(255,255,255,.07), var(--glass));
  border: 1px solid rgba(255,255,255,.22); box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
}
.sub__free {
  padding: 22px 20px; border-radius: var(--r-xl);
  background: var(--glass); border: 1px solid var(--glass-line); backdrop-filter: blur(14px);
}
.sub__price { font: 800 40px/1 var(--display); letter-spacing: -.03em; }
.sub__price span { font-size: 17px; color: var(--muted); margin-left: 5px; letter-spacing: 0; }
.sub__from { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.sub__free .plan__list { margin-bottom: 14px; }

/* кошелёк */
.wallet-top {
  padding: 24px 22px; border-radius: var(--r-xl);
  background: linear-gradient(180deg, rgba(255,255,255,.07), var(--glass));
  border: 1px solid var(--glass-line); backdrop-filter: blur(16px);
}
.wallet-top__sum { font: 800 42px/1 var(--display); letter-spacing: -.03em; }
.wallet-top__sum span { margin-left: 8px; font-size: 17px; color: var(--muted); letter-spacing: 0; }
.wallet-top__note { margin-top: 6px; font-size: 13px; color: var(--muted); }
.wallet-log { display: grid; gap: 9px; }
.wallet-log div { display: flex; gap: 12px; align-items: baseline; font-size: 13.5px; }
.wallet-log div span { flex: 1; min-width: 0; }
.wallet-log div b { flex: none; font-variant-numeric: tabular-nums; }
.wallet-log div b.is-plus { color: #fff; }

/* ============================================ типы переписки
   Различие мягкое: форма аватара и мелкая пометка у названия. Никакого цвета
   и крупных ярлыков — тип должен читаться краем глаза, а не бросаться. */
.avatar--soft { border-radius: 30%; }
.dialog__kind {
  margin-left: 7px; padding: 1px 6px; border-radius: 999px;
  background: var(--rock-600); color: var(--faint);
  font: 500 10.5px/1.5 var(--body); vertical-align: 1px; white-space: nowrap;
}

/* Канал = лента постов, как в телеграме: во всю ширину, без пузырьков
   «свой/чужой», аккуратные разделители между записями. */
.conv--channel .msg { max-width: 100%; }
.conv--channel .msg__bubble {
  width: 100%; max-width: 100%;
  background: transparent; border: 0; border-radius: 0;
  padding: 14px 2px 16px;
  box-shadow: none;
}
.conv--channel .msg + .msg .msg__bubble { border-top: 1px solid var(--line-soft); }
.conv--channel .msg__text { font-size: 15.5px; line-height: 1.55; }
.conv--channel .msg__img img { border-radius: var(--r-md); max-height: 420px; }
.conv--channel .msg__meta { color: var(--faint); }
/* автора в канале не повторяем у каждой записи — он один и тот же */
.conv--channel .msg__author { display: none; }

/* Группы в настройках: экран из десятка карточек без разделения читается как
   стена. Заголовок группы даёт точку опоры для глаза. */
.settings-group {
  display: flex; align-items: baseline; gap: 8px;
  margin: 22px 2px 8px;
  font: 700 12px/1.4 var(--body); letter-spacing: .06em; text-transform: uppercase;
  color: var(--faint);
}
.settings-group:first-child { margin-top: 4px; }
.settings-group span {
  font: 400 11.5px/1.4 var(--body); letter-spacing: 0; text-transform: none;
}
