/* =============================================================================
   МАСШТАБ ИНТЕРФЕЙСА
   Один множитель на все размеры текста. Правила ниже умножают свои пиксели на
   него, поэтому «сделать крупнее» — это одна строка здесь, а не второй файл с
   копиями селекторов.

   Картинки и геометрия панелей множителем не затронуты: zoom у корня растянул бы
   вместе с текстом и снимок за экраном.
   ============================================================================= */

:root { --ui: 1; }

/* Message replies and the essential-cookie notice share the site's theme tokens. */
.composer__reply { display: flex; align-items: center; gap: 12px; margin: 0 6px 10px; padding: 6px 10px; border-left: 3px solid var(--accent); min-width: 0; }
.composer__reply > div { flex: 1; min-width: 0; }
.composer__reply strong, .composer__reply span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.composer__reply strong { color: var(--accent); }
.composer__reply span { color: var(--muted); }
.composer__reply button { flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--text); font-size: 24px; cursor: pointer; }
.message__reply { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 5px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; cursor: pointer; opacity: 0; }
.message__reply svg { width: 18px; height: 18px; }
.message:hover .message__reply, .message__reply:focus-visible { opacity: 1; }
.message__reply:hover, .composer__reply button:hover { color: var(--accent); background: var(--accent-soft); }
.message__quote { display: block; width: 100%; max-width: 360px; margin: 3px 0 5px; padding: 8px 10px; border: 0; border-left: 3px solid var(--accent); border-radius: 5px; text-align: left; font: inherit; color: var(--muted); background: var(--accent-soft); cursor: pointer; }
.message__quote strong, .message__quote span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.message__quote strong { color: var(--accent); }
.message__quote:disabled { cursor: default; font-size: 13px; }
.message--highlight .message__body { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 12px; }
.cookie-notice { position: fixed; right: 20px; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 55; width: min(420px, calc(100% - 40px)); max-height: calc(100dvh - 40px); overflow: auto; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel-solid); color: var(--text); box-shadow: var(--shadow); }
.cookie-notice strong { font-size: 15px; }
.cookie-notice p { margin: 8px 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.cookie-notice summary { width: fit-content; color: var(--accent); cursor: pointer; font-size: 13px; padding: 4px 0; }
.cookie-notice__accept { margin-top: 12px; min-height: 44px; padding: 10px 18px; border: 0; border-radius: 10px; background: var(--accent); color: #08101c; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.cookie-notice__accept:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
body[data-page="chat"] .cookie-notice { bottom: auto; top: max(16px, env(safe-area-inset-top)); }
.composer__reply button:focus-visible, .message__reply:focus-visible, .message__quote:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 720px), (hover: none) {
    .message__reply { opacity: 1; width: 44px; height: 44px; }
    .cookie-notice { right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); width: calc(100% - 24px); padding: 15px; }
}

/* Текст не масштабируем по ширине окна: 16 px остаются 16 px и на ноутбуке,
   и на большом мониторе. Масштаб при необходимости меняет сам браузер. */
/* =============================================================
   ANON CHAT — современный чат-look (Telegram/Discord dark)
   Базовые токены
   ============================================================= */
:root {
    color-scheme: dark;
    /* Кибер/неон-палитра 2026: глубокий тёмно-синий + неоновый акцент.
       Сохраняем gaming-характер сайта, добавляем glow и моноширинные цифры. */
    --bg: #0f1220;
    --bg-deep: #0a0c16;
    --panel: #141826;
    --panel-solid: #141826;
    --panel-soft: #181d2e;
    --field: #1d2238;
    --line: rgba(120, 180, 255, .12);
    --line-soft: rgba(120, 180, 255, .06);
    --line-glow: rgba(91, 200, 255, .35);
    --text: #e8ecf5;
    --muted: #aeb4cc;
    --subtle: #6e7593;
    --accent: #4cc9ff;          /* неоновый циан-синий */
    --accent-strong: #2bb3f0;
    --accent-soft: rgba(76, 201, 255, .14);
    --accent-glow: rgba(76, 201, 255, .55);
    --neon-purple: #a855f7;
    --neon-pink: #f471b5;
    --success: #2ee6a6;
    --warning: #ffb340;
    --danger: #ff5c6c;
    --shadow: 0 8px 28px rgba(0, 0, 0, .5);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, .65);
    --glow-sm: 0 0 0 1px rgba(76, 201, 255, .22), 0 0 18px rgba(76, 201, 255, .12);
    --glow-md: 0 0 24px rgba(76, 201, 255, .25);
    --focus-ring: 0 0 0 2px rgba(76, 201, 255, .55), 0 0 18px rgba(76, 201, 255, .25);
    --bubble-in: #1a2034;
    --bubble-out: linear-gradient(135deg, #4cc9ff, #2bb3f0);
    --radius: 14px;
    --radius-sm: 10px;
    --radius-pill: 999px;
    --mono: "SF Mono", "JetBrains Mono", "Cascadia Code", Consolas, "Liberation Mono", monospace;
}

button:focus-visible,
.button:focus-visible,
.icon-btn:focus-visible,
.tool-button:focus-visible,
.site-link:focus-visible,
a:focus-visible,
select:focus-visible,
[role="button"]:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

* { box-sizing: border-box; }
:root { scroll-behavior: smooth; }
/* Фон задан у html: до загрузки снимка и стилей темы страница иначе показывает
   белый лист, и на медленной сети это первое, что видит человек. */
html {
    background: #0b1020;
    color-scheme: dark;
}

html[data-theme="light"] { background: #0f5f68; color-scheme: light; }

html, body { min-height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Exo 2', -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 20px;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

button, textarea, input, a { font: inherit; }

.site-container {
    width: min(1170px, calc(100% - 30px));
    margin: 0 auto;
}

.site-top, .site-nav, .shell { position: relative; }

.site-top {
    background: rgba(12, 15, 28, .92);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 0 rgba(76, 201, 255, .06), 0 6px 20px rgba(0, 0, 0, .35);
}

.site-top__inner {
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.brand {
    display: inline-flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
    color: var(--text);
    text-decoration: none;
    font-weight: 800;
}

.brand strong {
    font-size: 20px;
    line-height: 1;
    letter-spacing: .02em;
    background: linear-gradient(135deg, var(--accent), var(--neon-purple));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.brand span { color: var(--accent); font-size: 12px; font-weight: 700; }

.site-link {
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.site-link:hover { color: var(--text); background: var(--field); border-color: var(--line); }

.site-top__actions { display: inline-flex; align-items: center; gap: 10px; }

.site-link--admin { border-color: rgba(62, 207, 142, .4); color: #6fe0b0; }
.site-link--admin:hover { background: rgba(62, 207, 142, .14); border-color: rgba(62, 207, 142, .4); }

.site-nav {
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.site-nav .site-container {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--subtle);
}

.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--accent); }

.site-nav a + a::before {
    content: "/";
    margin-right: 9px;
    color: rgb(108, 108, 118);
}

.shell {
    min-height: calc(100vh - 104px);
    padding: 22px 0;
    display: grid;
    align-items: stretch;
}

/* =============================================================
   КАРТОЧКИ-ПОВЕРХНОСТИ
   ============================================================= */
.hero, .identity, .chat {
    width: 100%;
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(24, 30, 50, .94), rgba(16, 20, 36, .94));
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* Тонкая неоновая верхняя обводка на ключевых поверхностях */
.chat::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: inset 0 1px 0 rgba(76, 201, 255, .08);
}

.hero__content, .identity__content, .chat__header, .roombar,
.participants-line, .composer, .messages, .notice {
    position: relative;
    z-index: 1;
}

/* =============================================================
   HERO (стартовый экран — одна колонка)
   ============================================================= */
.hero {
    min-height: 0;
    display: grid;
    place-items: center;
}

.hero__content {
    width: min(640px, 100%);
    padding: clamp(32px, 6vw, 64px);
    text-align: center;
}

.hero__head { margin-bottom: 24px; }

.eyebrow {
    margin: 0 0 12px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .18em;
    font-family: var(--mono);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.eyebrow::before {
    content: "";
    width: 18px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent));
}

h1 {
    margin: 0;
    max-width: 760px;
    font-size: clamp(30px, 5vw, 46px);
    line-height: 1.08;
    font-weight: 800;
    letter-spacing: -.01em;
}

/* Неоновый акцент на слове «чат» в hero (через <span>) */
h1 span {
    background: linear-gradient(120deg, var(--accent), var(--neon-purple));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 18px rgba(76, 201, 255, .35));
}

.lead {
    max-width: 520px;
    margin: 16px auto 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.6;
}

.create-option {
    width: min(560px, 100%);
    margin: 20px auto 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    display: grid;
    grid-template-columns: 20px 1fr;
    gap: 12px;
    align-items: start;
    background: rgba(15, 19, 34, .5);
    color: var(--muted);
    cursor: pointer;
    text-align: left;
    transition: border-color .2s, box-shadow .2s, background .2s;
}

.create-option:hover {
    border-color: rgba(76, 201, 255, .3);
    box-shadow: var(--glow-sm);
    background: rgba(76, 201, 255, .04);
}

.create-option input { width: 18px; min-height: 18px; margin-top: 2px; accent-color: var(--accent); }
.create-option strong { display: block; color: var(--text); font-size: 14px; }
.create-option small { display: block; margin-top: 3px; color: var(--subtle); line-height: 1.45; }

.room-password-create {
    width: min(560px, 100%);
    margin: 12px auto 0;
}

.room-password-create .create-option { margin: 0; width: 100%; }
.create-option--password { border-color: rgba(91, 141, 239, .24); }

.password-row {
    margin-top: 10px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 26px;
    justify-content: center;
}

.hero__badges {
    list-style: none;
    margin: 28px 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.hero__badges li {
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    padding: 8px 14px;
    background: rgba(20, 25, 44, .6);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    backdrop-;
    transition: border-color .2s, color .2s, box-shadow .2s;
}
.hero__badges li:hover {
    border-color: rgba(76, 201, 255, .3);
    color: var(--text);
    box-shadow: var(--glow-sm);
}
.hero__badges svg {
    width: 15px;
    height: 15px;
    stroke: var(--accent);
    fill: none;
    stroke-width: 2;
    flex-shrink: 0;
}

/* =============================================================
   IDENTITY (ввод ника)
   ============================================================= */
.identity {
    min-height: 320px;
    display: grid;
    place-items: center;
}

.identity__content { width: min(480px, 100%); padding: clamp(28px, 5vw, 56px); }

.identity__form {
    margin-top: 22px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
}

#joinPasswordInput { grid-column: 1 / -1; }

.password-copy-card {
    margin-top: 18px;
    border: 1px solid rgba(62, 207, 142, .34);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    align-items: center;
    background: rgba(62, 207, 142, .08);
    text-align: left;
}

.password-copy-card span {
    grid-column: 1 / -1;
    color: var(--subtle);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.password-copy-card strong {
    min-width: 0;
    overflow: hidden;
    color: var(--text);
    font-size: 18px;
    letter-spacing: .04em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =============================================================
   КНОПКИ
   ============================================================= */
.button, .icon-btn, .tool-button {
    border: 2px solid transparent;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .1s ease;
}

.button {
    min-height: 44px;
    padding: 0 20px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
}

.button:hover { box-shadow: 0 5px 19px rgba(0, 0, 0, .18); transform: translateY(-1px); }
.button:active { transform: translateY(0); }

.button--primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    border-color: transparent;
    box-shadow: 0 0 0 1px rgba(76, 201, 255, .4), 0 8px 24px rgba(76, 201, 255, .3);
}
.button--primary:hover {
    background: linear-gradient(135deg, #5dd4ff, var(--accent));
    box-shadow: 0 0 0 1px rgba(76, 201, 255, .6), 0 10px 32px rgba(76, 201, 255, .45);
    transform: translateY(-2px);
}

.button--ghost {
    border-color: rgba(76, 201, 255, .4);
    background: rgba(76, 201, 255, .06);
    color: var(--accent);
}
.button--ghost:hover {
    background: rgba(76, 201, 255, .16);
    border-color: var(--accent);
    color: #fff;
    box-shadow: var(--glow-sm);
}

.button--danger { background: rgba(255, 92, 108, .12); border-color: rgba(255, 92, 108, .45); color: #ffb3ba; }
.button--danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; box-shadow: 0 0 20px rgba(255, 92, 108, .4); }

.button__icon { width: 20px; height: 20px; stroke: currentColor; }

/* =============================================================
   ЧАТ — КАРКАС
   ============================================================= */
.chat {
    height: calc(100vh - 150px);
    min-height: 520px;
    max-height: 880px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    border: 0;
}

.chat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    flex-shrink: 0;
    background: rgba(15, 19, 34, .7);
    border-bottom: 0;
}

.chat__title { display: flex; align-items: center; gap: 10px; min-width: 0; }

/* Аватар комнаты — иконка-замок в круге с акцентным фоном */
.chat__avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent), var(--neon-purple));
    color: #fff;
    /* Ни кольца, ни размытой подложки: вокруг замка получался светящийся ореол. */
    box-shadow: none;
    position: relative;
}
.chat__avatar::after { content: none; }
.chat__avatar svg { width: 20px; height: 20px; stroke: currentColor; }

.chat__heading { min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.chat__name {
    font-size: calc(15px * var(--ui));
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

/* Подзаголовок: дот-статус · текст · N в сети */
.chat__sub {
    font-size: calc(11.5px * var(--ui));
    color: var(--subtle);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Точка статуса без гало: цвета достаточно. */
.chat__sub .status__dot { width: 8px; height: 8px; box-shadow: none; }
.chat__sub .status__dot[data-mode="ok"] { box-shadow: none; }
.chat__sub .status__dot[data-mode="error"] { box-shadow: none; }
.chat__sep { opacity: .4; margin: 0 2px; }

/* Блок таймера в правой части шапки — моноширинный, с неоновой обводкой */
.chat__timer {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 11px;
    border-radius: var(--radius-pill);
    background: rgba(12, 16, 30, .6);
    border: 0;
    transition: background .2s;
}
.chat__timer:hover { background: rgba(76, 201, 255, .08); box-shadow: none; }
.chat__timer-icon { width: 15px; height: 15px; stroke: var(--accent); flex-shrink: 0; }
.chat__timer-val {
    font-family: var(--mono);
    font-size: calc(13px * var(--ui));
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    letter-spacing: .04em;
    text-shadow: 0 0 12px rgba(76, 201, 255, .4);
}

/* Прогресс-бар жизни комнаты (под шапкой) */
.chat__ttlbar {
    height: 3px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, .05);
    overflow: hidden;
}
.chat__ttlfill {
    height: 100%;
    width: 100%;
    background: var(--success);
    box-shadow: none;
    transition: width 1s linear, background .6s ease, box-shadow .6s ease;
}
.chat__ttlfill[data-tier="mid"]  { background: var(--warning); box-shadow: none; }
.chat__ttlfill[data-tier="low"]  { background: var(--danger); box-shadow: none; animation: ttlBlink 1s ease-in-out infinite; }

@keyframes ttlBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: .55; }
}

/* Точка статуса: только цвет. Кольцо и пульсация читались как свечение. */
.status__dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--warning);
    box-shadow: none;
    flex-shrink: 0;
}

.status__dot[data-mode="ok"] {
    background: var(--success);
    box-shadow: none;
    animation: none;
}

.status__dot[data-mode="error"] {
    background: var(--danger);
    box-shadow: none;
}

/* Иконки-кнопки в хедере */
.chat__tools { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }

.icon-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--muted);
}

.icon-btn svg { width: 18px; height: 18px; stroke: currentColor; }

.icon-btn:hover { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.icon-btn--edit { border-color: transparent; color: var(--accent); }
.icon-btn--share { background: rgba(62, 207, 142, .14); border-color: transparent; color: #6fe0b0; }
.icon-btn--share:hover { background: rgba(62, 207, 142, .3); color: #fff; }

.icon-btn--sound { border-color: transparent; color: var(--muted); }
.icon-btn--sound[data-sound="on"] { border-color: transparent; color: var(--accent); }
.icon-btn--sound[data-sound="off"] { border-color: transparent; color: var(--subtle); opacity: .65; }

.icon-btn--danger { background: rgba(239, 83, 80, .12); border-color: transparent; color: #f2d0d0; }
.icon-btn--danger:hover { background: #ef5350; color: #fff; }

/* =============================================================
   INFO-БАР (таймер · онлайн · ник · история) + участники
   ============================================================= */
.roombar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    padding: 8px 14px;
    flex-shrink: 0;
    border-bottom: 0;
    background: rgba(15, 19, 34, .5);
}

.roombar__item { display: inline-flex; align-items: baseline; gap: 8px; min-width: 0; }

.roombar__label {
    color: var(--subtle);
    font-size: calc(10.5px * var(--ui));
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}

.roombar__value {
    color: var(--text);
    font-size: calc(13px * var(--ui));
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.participants-line {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px;
    flex-shrink: 0;
    border-bottom: 0;
    background: rgba(15, 19, 34, .5);
}

.participant-list {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 7px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.participant-list::-webkit-scrollbar { display: none; }

.participant-chip {
    flex: 0 0 auto;
    max-width: 220px;
    border: 0;
    border-radius: var(--radius-pill);
    padding: 4px 10px;
    overflow: hidden;
    color: var(--text);
    background: rgba(76, 201, 255, .1);
    font-size: calc(11.5px * var(--ui));
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: border-color .18s, box-shadow .18s;
}
.participant-chip:hover { background: rgba(76, 201, 255, .16); box-shadow: none; }

.participant-chip--empty { border-color: var(--line); color: var(--subtle); background: rgba(15, 19, 34, .5); }

/* =============================================================
   УВЕДОМЛЕНИЯ
   ============================================================= */
.notice {
    margin: 12px 16px 0;
    border: 1px solid rgba(232, 148, 59, .35);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    color: #f2c39c;
    background: rgba(232, 148, 59, .1);
    flex-shrink: 0;
    font-size: 13px;
}

.notice--danger { border-color: rgba(239, 83, 80, .4); color: #f4c5c5; background: rgba(239, 83, 80, .12); }
.notice--success { border-color: rgba(62, 207, 142, .35); color: #a8e6ca; background: rgba(62, 207, 142, .1); }

.chat-wait {
    padding: 10px 14px 0;
    flex-shrink: 0;
}

.chat-wait__panel {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    border: 0;
    border-radius: 12px;
    padding: 12px;
    background: rgba(8, 15, 31, .62);
    box-shadow: none;
}

.chat-wait__icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #4ad7ff;
    background: rgba(40, 160, 255, .12);
    box-shadow: none;
}

.chat-wait__icon svg { width: 20px; height: 20px; stroke: currentColor; }
.chat-wait strong { display: block; color: #fff; font-size: calc(15px * var(--ui)); font-weight: 750; }
.chat-wait p { margin: 3px 0 0; color: var(--muted); font-size: calc(12.5px * var(--ui)); line-height: 1.4; }

.chat-wait__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.ghost-btn {
    border: 0;
    border-radius: 9px;
    padding: 8px 11px;
    color: #dff6ff;
    background: rgba(4, 13, 31, .55);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.ghost-btn:hover { background: rgba(28, 104, 180, .32); }

@media (max-width: 720px) {
    .chat-wait__panel {
        grid-template-columns: 36px minmax(0, 1fr);
        gap: 10px;
        padding: 12px;
    }

    .chat-wait__actions {
        grid-column: 1 / -1;
        justify-content: stretch;
    }

    .chat-wait__actions .ghost-btn {
        flex: 1 1 130px;
    }
}

/* =============================================================
   ЛЕНТА СООБЩЕНИЙ + ПУЗЫРИ
   ============================================================= */
.messages-wrap {
    flex: 1 1 0%;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

.messages {
    flex: 1 1 0%;
    min-height: 0;
    padding: 18px 16px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .14) transparent;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.messages::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-thumb { border-radius: 4px; background: rgba(255, 255, 255, .14); }
.messages::-webkit-scrollbar-track { background: transparent; }

.messages[data-admin="true"] {
    user-select: text;
    -webkit-user-select: text;
    -webkit-touch-callout: default;
}

/* Ряд сообщения: аватар + тело */
.message {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    grid-template-areas: "avatar body";
    gap: 0 10px;
    align-items: flex-end;
    margin-top: 10px;
    max-width: min(82%, 760px);
    align-self: flex-start;
}

.message--mine {
    align-self: flex-end;
    grid-template-columns: minmax(0, 1fr) 36px;
    grid-template-areas: "body avatar";
}

.message--grouped { margin-top: 3px; }

/* Аватар-инициал */
.message__avatar {
    grid-area: avatar;
    align-self: flex-end;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--avatar-bg, var(--accent));
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    text-transform: uppercase;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .4);
}

.message__avatar--spacer {
    background: transparent;
    box-shadow: none;
}

.message__body {
    grid-area: body;
    min-width: 0;
}

.message__meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 0 4px 3px;
    color: var(--subtle);
    font-size: calc(12px * var(--ui));
}

.message--mine .message__meta { justify-content: flex-end; }

.message__name {
    color: var(--accent);
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message__meta time { color: var(--subtle); font-weight: 600; }

.message__receipt {
    width: 18px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--subtle);
}

.message__receipt svg {
    width: 18px;
    height: 12px;
    overflow: visible;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.message__receipt-second { opacity: 0; }
.message__receipt.is-read { color: #4cc9ff; }
.message__receipt.is-read .message__receipt-second { opacity: 1; }

.message__delete {
    width: 22px;
    height: 22px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--subtle);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease, color .15s ease, background .15s ease;
}

.message__delete svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.message--mine:hover .message__delete,
.message__delete:focus-visible {
    opacity: 1;
    pointer-events: auto;
}

.message:hover .message__delete { opacity: 1; pointer-events: auto; }

.message__delete:hover { color: #ff7b86; background: rgba(255, 92, 108, .1); }

.message__text {
    margin: 0;
    padding: 10px 14px;
    border-radius: 16px 16px 16px 4px;
    background: var(--bubble-in);
    border: 1px solid rgba(120, 180, 255, .08);
    color: var(--text);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.45;
    font-size: calc(14.5px * var(--ui));
    box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}

/* Хвостик к первому сообщению группы (через border-radius уже задан) */

.message--mine .message__text {
    border-radius: 16px 16px 4px 16px;
    background: var(--bubble-out);
    border-color: rgba(76, 201, 255, .5);
    color: #fff;
    box-shadow: 0 0 0 1px rgba(76, 201, 255, .12), 0 4px 16px rgba(76, 201, 255, .22);
}

/* Микро-анимация появления нового сообщения */
.message {
    animation: msgIn .22s cubic-bezier(.21, 1.02, .73, 1);
}
@keyframes msgIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.message--grouped .message__text { border-radius: 14px; }
.message--mine.message--grouped .message__text { border-radius: 14px; }

/* Системное сообщение — по центру, без аватара.
   ВАЖНО: flex, не grid; иначе grid-колонка 1fr коллапсирует до 1 символа
   из-за overflow-wrap:anywhere и текст рисуется по одной букве в строку. */
.message--system {
    display: flex;
    justify-content: center;
    max-width: min(90%, 620px);
    width: auto;
    align-self: center;
    margin: 14px 0 6px;
}

.message--system .message__text {
    width: auto;
    max-width: 100%;
    border: 1px solid rgba(71, 188, 138, .18);
    border-radius: 999px;
    padding: 6px 16px;
    color: var(--subtle);
    background: rgba(71, 188, 138, .08);
    text-align: center;
    font-size: 12.5px;
    box-shadow: none;
    white-space: normal;
    overflow-wrap: normal;
}

/* =============================================================
   КНОПКА ПРОКРУТКИ ВНИЗ
   ============================================================= */
.scroll-down {
    position: absolute;
    bottom: 88px;
    right: 18px;
    z-index: 6;
    border: 1px solid rgba(108, 151, 212, .5);
    border-radius: 999px;
    padding: 7px 16px;
    background: rgba(22, 28, 46, .94);
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp .18s ease;
    white-space: nowrap;
    transition: background .15s, color .15s, border-color .15s;
}

.scroll-down:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =============================================================
   ИНДИКАТОР ПЕЧАТИ
   ============================================================= */
.typing-line {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 4px 6px;
    color: var(--subtle);
    font-size: 12px;
    font-style: italic;
}

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

.typing-dots i {
    display: block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    font-style: normal;
    animation: typing-bounce 1.25s ease-in-out infinite;
    opacity: .5;
}

.typing-dots i:nth-child(2) { animation-delay: .2s; }
.typing-dots i:nth-child(3) { animation-delay: .4s; }

@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0);    opacity: .4; }
    30%           { transform: translateY(-5px); opacity: 1;  }
}

/* =============================================================
   КОМПОУЗЕР (pill-форма с inline-кнопкой отправки)
   ============================================================= */
.composer {
    display: block;
    padding: 12px 16px;
    flex-shrink: 0;
    border-top: 1px solid var(--line);
    background: rgba(15, 19, 34, .7);
}

.composer__field {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    padding: 4px 5px 4px 14px;
    background: rgba(12, 16, 30, .7);
    transition: border-color .18s, box-shadow .18s;
}

.composer__field:focus-within {
    border-color: rgba(76, 201, 255, .45);
    box-shadow: none;
}

.composer__field textarea {
    flex: 1 1 0%;
    min-width: 0;
    width: auto;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: var(--text);
    padding: 10px 0;
    resize: none;
}

.composer__field textarea:focus { box-shadow: none; }

.composer__count {
    position: absolute;
    bottom: 100%;
    right: 4px;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 700;
    color: var(--subtle);
    pointer-events: none;
    transition: color .2s;
    line-height: 1;
}

.composer__count--warn   { color: var(--warning); }
.composer__count--danger { color: var(--danger); }

.composer__send {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    border: 0;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    /* Без цветного ореола вокруг круга: это читалось как свечение. */
    box-shadow: none;
    transition: background .15s, transform .1s, box-shadow .15s;
}

.composer__send:hover { box-shadow: none; transform: scale(1.06); }
.composer__send:active { transform: scale(.94); }
.composer__send svg { width: 18px; height: 18px; stroke: currentColor; }
.composer--locked { opacity: .68; }
.composer--locked .composer__field { border-color: rgba(255, 255, 255, .08); background: rgba(10, 15, 28, .7); }
.composer--locked button { cursor: not-allowed; transform: none; }

/* Кнопка смайлов слева в композере */
.composer__smile {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    border: 0;
    background: transparent;
    color: var(--subtle);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s, color .15s, transform .1s;
}
.composer__smile svg { width: 22px; height: 22px; stroke: currentColor; }
.composer__smile:hover { background: var(--accent-soft); color: var(--accent); transform: scale(1.05); }
.composer__smile:active { transform: scale(.92); }
.composer__smile[aria-expanded="true"] { color: var(--accent); background: var(--accent-soft); }

/* Смайл внутри сообщения */
.message__text .smile,
.message__text img.smile {
    display: inline-block;
    width: 22px;
    height: 22px;
    vertical-align: -5px;
    margin: 0 1px;
    -webkit-user-drag: none;
}

/* =============================================================
   ПИКЕР СМАЙЛОВ (поповер над композером)
   ============================================================= */
.smile-picker {
    flex-shrink: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(15, 19, 34, .75);
    padding: 10px;
    max-height: 200px;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .14) transparent;
    animation: smilePickerIn .16s ease;
}
.smile-picker::-webkit-scrollbar { width: 7px; }
.smile-picker::-webkit-scrollbar-thumb { border-radius: 4px; background: rgba(255, 255, 255, .14); }
.smile-picker::-webkit-scrollbar-track { background: transparent; }

.smile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
    gap: 4px;
}

.smile-cell {
    border: 0;
    background: transparent;
    border-radius: 8px;
    padding: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .12s, transform .1s;
}
.smile-cell img {
    width: 30px;
    height: 30px;
    -webkit-user-drag: none;
}
.smile-cell:hover { background: var(--accent-soft); transform: scale(1.12); }
.smile-cell:active { transform: scale(.94); }

@keyframes smilePickerIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

button:disabled { cursor: wait; opacity: .6; }

/* Поля ввода вне композера (ник, identity) */
textarea, input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(15, 19, 34, .6);
    color: var(--muted);
    outline: 0;
    box-shadow: none;
}

textarea {
    height: 46px;
    min-height: 46px;
    max-height: 132px;
    resize: none;
    padding: 12px 14px;
}

input { min-height: 46px; padding: 0 14px; }

textarea::placeholder, input::placeholder { color: var(--subtle); }

textarea:focus, input:focus {
    border-color: rgba(108, 151, 212, .5);
    box-shadow: 0 0 0 3px rgba(108, 151, 212, .12);
    color: var(--text);
}

[hidden] { display: none !important; }

/* =============================================================
   TURNSTILE / TOTP
   ============================================================= */
.turnstile-shell, .totp-box {
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 12px;
    background: rgba(28, 36, 52, .52);
}

.totp-box { display: grid; gap: 6px; }
.totp-box span { color: var(--subtle); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.totp-box strong { overflow-wrap: anywhere; color: var(--text); font-size: 15px; }

/* =============================================================
   RESPONSIVE — mobile-first, промежуточные брейкпоинты
   ============================================================= */

/* Планшеты / узкий десктоп */
@media (max-width: 820px) {
    .shell {
        width: 100%;
        min-height: calc(100vh - 100px);
        padding: 14px;
    }

    .hero, .identity, .chat { border-radius: 12px; }

    .hero__content { padding: 32px 22px; }

    .chat {
        height: calc(100vh - 128px);
        min-height: 500px;
        max-height: none;
    }

    .identity__form { grid-template-columns: 1fr; }

    .roombar { gap: 6px 18px; padding: 9px 14px; }

    .message { max-width: 88%; }
}

/* Телефоны */
@media (max-width: 640px) {
    .site-top__inner { min-height: 54px; gap: 10px; }
    .site-link { display: none; }
    .brand strong { font-size: 18px; }

    .site-nav { display: none; }

    .shell {
        min-height: calc(100vh - 56px);
        padding: 10px;
    }

    /* На телефоне чат занимает весь экран поверх навигации */
    .chat {
        height: calc(100vh - 76px);
        min-height: 0;
        border-radius: 12px;
    }

    .chat__header { padding: 9px 12px; gap: 8px; }

    .chat__avatar { width: 36px; height: 36px; border-radius: 10px; }
    .chat__avatar svg { width: 20px; height: 20px; }

    .chat__name { font-size: 15px; }
    .chat__sub { font-size: 11px; gap: 4px; }

    /* Таймер компактнее на мобиле */
    .chat__timer { padding: 5px 9px; border-radius: 8px; }
    .chat__timer-val { font-size: 13px; }
    .chat__timer-icon { display: none; }

    .icon-btn { width: 34px; height: 34px; min-width: 34px; }
    .icon-btn svg { width: 17px; height: 17px; }

    .roombar {
        gap: 6px 14px;
        padding: 8px 12px;
    }
    .roombar__item:nth-child(3),
    .roombar__item:nth-child(4) { display: none; }

    .participants-line {
        padding: 8px 12px;
        gap: 10px;
    }

    .messages { padding: 14px 12px; }

    .message {
        grid-template-columns: 30px minmax(0, 1fr);
        max-width: 90%;
    }
    .message--mine {
        grid-template-columns: minmax(0, 1fr) 30px;
    }

    .message__avatar { width: 30px; height: 30px; font-size: 13px; }

    .scroll-down {
        bottom: 78px;
        right: 12px;
        padding: 6px 14px;
        font-size: 12px;
    }

    .composer { padding: 10px 12px; }
    .composer__field { border-radius: 20px; padding: 4px 4px 4px 8px; }
    .composer__field textarea { padding: 9px 0; }
    .composer__send { width: 36px; height: 36px; }
    .composer__smile { width: 34px; height: 34px; }
    .composer__smile svg { width: 20px; height: 20px; }

    /* Пикер смайлов повыше на мобиле */
    .smile-picker { max-height: 180px; padding: 8px; }
    .smile-grid { grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); }
    .smile-cell img { width: 32px; height: 32px; }

    .hero__content { padding: 28px 18px; }
    .actions { flex-direction: column; }
    .actions .button { width: 100%; }
    .password-row,
    .password-copy-card { grid-template-columns: 1fr; }
}

/* Очень узкие телефоны */
@media (max-width: 480px) {
    /* Прячем текст таймера — остаётся иконка + прогресс-бар под шапкой.
       Так 4 кнопки + аватар помещаются без переноса. */
    .chat__timer-val { display: none; }
    .chat__timer { padding: 7px; }
    .chat__timer-icon { display: block; }
}

@media (max-width: 380px) {
    .message { max-width: 94%; }
    .chat__tools { gap: 4px; }
    .icon-btn { width: 34px; height: 34px; min-width: 34px; }
    .chat__avatar { width: 34px; height: 34px; }
}

/* =============================================================
   АДАПТИВ ВЫСОТЫ для коротких экранов
   ============================================================= */
@media (max-height: 640px) and (max-width: 640px) {
    .chat { height: calc(100vh - 66px); }
    .roombar { display: none; }
}

/* =============================================
   ADMIN TAB SYSTEM (CSS-only, no JS needed)
   ============================================= */

.admin-tab-radio,
.stats-tab-radio {
    display: none;
}

.admin-pane { display: none; }

#admin-tab-rooms:checked ~ .admin-pane--rooms,
#admin-tab-stats:checked ~ .admin-pane--stats,
#admin-tab-moderation:checked ~ .admin-pane--moderation,
#admin-tab-security:checked ~ .admin-pane--security,
#admin-tab-log:checked ~ .admin-pane--log {
    display: block;
}

.stats-pane {
    display: none;
    padding: 14px 20px 20px;
}

#stats-tab-today:checked ~ .admin-analytics__header ~ .stats-pane--today,
#stats-tab-week:checked ~ .admin-analytics__header ~ .stats-pane--week,
#stats-tab-month:checked ~ .admin-analytics__header ~ .stats-pane--month,
#stats-tab-year:checked ~ .admin-analytics__header ~ .stats-pane--year {
    display: block;
}

/* Active state for stats period labels */
.admin-analytics:has(#stats-tab-today:checked) label[for="stats-tab-today"],
.admin-analytics:has(#stats-tab-week:checked) label[for="stats-tab-week"],
.admin-analytics:has(#stats-tab-month:checked) label[for="stats-tab-month"],
.admin-analytics:has(#stats-tab-year:checked) label[for="stats-tab-year"] {
    border-color: rgba(76, 201, 255, .5);
    color: #fff;
    background: rgba(76, 201, 255, .18);
}

/* =============================================
   ADMIN PANEL LAYOUT
   ============================================= */

.admin-panel {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(24, 30, 50, .85), rgba(16, 20, 36, .9));
    box-shadow: var(--shadow);
    overflow: hidden;
}

.admin-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
    background: rgba(12, 16, 30, .6);
    box-shadow: inset 0 1px 0 rgba(76, 201, 255, .06);
}

.admin-panel__brand h1 { margin: 0; font-size: 22px; line-height: 1.15; font-weight: 800; }

.admin-panel__actions { display: inline-flex; gap: 6px; align-items: center; }
.admin-panel__actions form { margin: 0; }

.admin-notice { margin: 12px 16px 0; }

/* === Компактный статус-бар: одна полоса с метриками === */
.status-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 22px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(90deg, rgba(12, 16, 30, .7), rgba(18, 24, 44, .5));
    flex-wrap: wrap;
}

.status-bar__item {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    padding: 0 10px;
    min-width: 0;
}

.status-bar__label {
    color: var(--subtle);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    white-space: nowrap;
}

.status-bar__value {
    color: var(--text);
    font-size: 17px;
    font-weight: 700;
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
}

.status-bar__value--accent {
    color: var(--accent);
    text-shadow: 0 0 12px rgba(76, 201, 255, .4);
}

.status-bar__sep {
    width: 1px;
    height: 20px;
    background: var(--line);
    flex-shrink: 0;
}

.status-bar__live {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--success);
    font-size: 11px;
    font-weight: 700;
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: .08em;
}

.status-bar__pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 0 rgba(46, 230, 166, .6);
    animation: livePulse 2s ease-out infinite;
}

@keyframes livePulse {
    0%   { box-shadow: 0 0 0 0 rgba(46, 230, 166, .5); }
    70%  { box-shadow: 0 0 0 8px rgba(46, 230, 166, 0); }
    100% { box-shadow: 0 0 0 0 rgba(46, 230, 166, 0); }
}

/* === Сегментированный таб-контрол === */
.seg-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 22px 0;
    border-bottom: 1px solid var(--line);
    background: rgba(12, 16, 30, .3);
    overflow-x: auto;
    scrollbar-width: none;
}
.seg-tabs::-webkit-scrollbar { display: none; }

.seg-tabs__item {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px 12px;
    color: var(--muted);
    font-weight: 600;
    font-size: 13.5px;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 8px 8px 0 0;
    background: transparent;
    white-space: nowrap;
    transition: color .15s, background .15s, border-color .15s;
    margin-bottom: -1px;
}

.seg-tabs__item svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }

.seg-tabs__item:hover {
    color: var(--text);
    background: rgba(76, 201, 255, .06);
}

.seg-tabs__badge {
    min-width: 18px;
    height: 18px;
    border-radius: var(--radius-pill);
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(76, 201, 255, .22);
    color: var(--accent);
    font-size: 10px;
    font-weight: 800;
    font-family: var(--mono);
}
.seg-tabs__badge--warn { background: rgba(255, 92, 108, .22); color: var(--danger); }

/* === Активные табы (radio+:has) — неоновая подсветка === */
.admin-panel:has(#admin-tab-rooms:checked) .seg-tabs__item[for="admin-tab-rooms"],
.admin-panel:has(#admin-tab-stats:checked) .seg-tabs__item[for="admin-tab-stats"],
.admin-panel:has(#admin-tab-moderation:checked) .seg-tabs__item[for="admin-tab-moderation"],
.admin-panel:has(#admin-tab-security:checked) .seg-tabs__item[for="admin-tab-security"],
.admin-panel:has(#admin-tab-log:checked) .seg-tabs__item[for="admin-tab-log"] {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: rgba(76, 201, 255, .08);
}
.admin-panel:has(#admin-tab-rooms:checked) .seg-tabs__item[for="admin-tab-rooms"] svg,
.admin-panel:has(#admin-tab-stats:checked) .seg-tabs__item[for="admin-tab-stats"] svg,
.admin-panel:has(#admin-tab-moderation:checked) .seg-tabs__item[for="admin-tab-moderation"] svg,
.admin-panel:has(#admin-tab-security:checked) .seg-tabs__item[for="admin-tab-security"] svg,
.admin-panel:has(#admin-tab-log:checked) .seg-tabs__item[for="admin-tab-log"] svg {
    filter: drop-shadow(0 0 6px rgba(76, 201, 255, .5));
}

/* === icon-btn sizes === */
.icon-btn--xs { width: 30px; height: 30px; min-width: 30px; }
.icon-btn--xs svg { width: 15px; height: 15px; }

.admin-viewer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.admin-panel__header h1,
.admin-viewer__header h2,
.admin-empty h2 { margin: 0; font-size: 22px; line-height: 1.15; }

.admin-layout {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    min-height: 600px;
}

.admin-list {
    border-right: 1px solid var(--line);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    max-height: calc(100vh - 280px);
}

/* === Карточка комнаты: кликабельный блок + кнопка-иконка === */
.admin-room {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: stretch;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, rgba(24, 30, 50, .6), rgba(16, 20, 36, .7));
    overflow: hidden;
    transition: border-color .18s, box-shadow .18s, transform .12s;
}
.admin-room:hover {
    border-color: rgba(76, 201, 255, .35);
    box-shadow: var(--glow-sm);
    transform: translateY(-1px);
}

.admin-room--active {
    border-color: rgba(76, 201, 255, .55);
    box-shadow: inset 3px 0 0 var(--accent), var(--glow-sm);
}

.admin-room__main {
    display: block;
    padding: 12px 14px;
    color: inherit;
    text-decoration: none;
    min-width: 0;
}
.admin-room__main:hover { color: inherit; }

.admin-room__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.admin-room__top strong {
    color: var(--text);
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .03em;
}
.admin-room__ttl {
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    font-family: var(--mono);
    white-space: nowrap;
}

.admin-room__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}
.admin-room__pill {
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    padding: 2px 9px;
    color: var(--muted);
    background: rgba(15, 19, 34, .5);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.admin-room__participants { margin-top: 10px; }

.admin-room__del {
    display: flex;
    align-items: center;
    padding: 0 8px;
    border-left: 1px solid var(--line);
    margin: 0;
}
.admin-room__del .icon-btn { width: 32px; height: 32px; min-width: 32px; }

.admin-viewer { min-width: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); }

.admin-viewer__header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    background: rgba(12, 16, 30, .4);
}

.admin-viewer__info { min-width: 0; }
.admin-viewer__note { margin: 6px 0 0; color: var(--warning); font-size: 13px; }

.admin-viewer__actions { display: inline-flex; gap: 6px; align-items: center; flex-shrink: 0; }
.admin-viewer__actions form { margin: 0; }
.admin-viewer__ban { display: inline-flex; gap: 6px; align-items: center; }
.admin-viewer__ban-input {
    width: 130px;
    min-height: 34px;
    padding: 0 10px;
    font-size: 12.5px;
}

.admin-empty { padding: 34px; color: var(--muted); }

.admin-messages {
    max-height: 680px;
    user-select: text;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .1) transparent;
}

.admin-security {
    display: grid;
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
    gap: 16px;
    padding: 20px;
    background: rgba(34, 33, 39, .18);
}

.admin-security__card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    background: rgba(42, 41, 49, .38);
}

.admin-security__card h2 { margin: 0 0 14px; font-size: 20px; line-height: 1.2; }

.admin-form { display: grid; gap: 10px; }

.admin-form label { display: grid; gap: 6px; }

.admin-form label span {
    color: var(--subtle);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.admin-check { display: flex !important; align-items: center; gap: 10px !important; }
.admin-check input { width: 18px; height: 18px; }

.ban-list {
    max-height: 260px;
    margin-top: 14px;
    overflow: auto;
    display: grid;
    gap: 8px;
}

.ban-list__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: rgba(28, 36, 52, .58);
}

.ban-list__row strong,
.ban-list__row span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ban-list__row span { margin-top: 3px; color: var(--subtle); font-size: 12px; }

.admin-analytics { background: rgba(28, 36, 52, .22); }

.admin-analytics__header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
}

.admin-analytics__header h2 { margin: 0; font-size: 21px; line-height: 1.2; }

.stats-tabs { display: inline-flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

.stats-tabs__item {
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 11px;
    display: inline-flex;
    align-items: center;
    color: var(--muted);
    background: rgba(42, 41, 49, .44);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    transition: background .15s, color .15s, border-color .15s;
}

.stats-tabs__item:hover {
    color: var(--text);
    background: rgba(108, 151, 212, .12);
    border-color: rgba(108, 151, 212, .3);
}

.stats-tabs__item--active {
    border-color: rgba(108, 151, 212, .66);
    color: #fff;
    background: rgba(108, 151, 212, .22);
}

.analytics-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    gap: 10px;
}

.analytics-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    min-height: 76px;
    padding: 11px 12px;
    background: rgba(42, 41, 49, .44);
}

.analytics-card span {
    display: block;
    color: var(--subtle);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.analytics-card strong { display: block; margin-top: 8px; color: var(--text); font-size: 23px; line-height: 1; }

.analytics-split {
    margin-top: 14px;
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(300px, .95fr);
    gap: 14px;
}

.analytics-table {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(42, 41, 49, .32);
}

.analytics-table__head,
.analytics-row { display: grid; gap: 10px; align-items: center; }

.analytics-table__head {
    display: flex;
    justify-content: space-between;
    min-height: 44px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    color: var(--subtle);
    font-size: 13px;
}

.analytics-table__head strong { color: var(--text); }

.analytics-table__rows {
    max-height: 360px;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .1) transparent;
}

.analytics-row {
    min-height: 42px;
    padding: 9px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, .05);
    color: var(--muted);
    font-size: 13px;
}

.analytics-table--ip .analytics-row {
    grid-template-columns: minmax(120px, 1fr) minmax(70px, auto) minmax(70px, auto) minmax(70px, auto) minmax(72px, auto) auto;
}

.analytics-table--daily .analytics-row {
    grid-template-columns: minmax(100px, 1fr) minmax(78px, auto) minmax(78px, auto);
}

.analytics-row:last-child { border-bottom: 0; }

.analytics-row strong {
    min-width: 0;
    overflow: hidden;
    color: var(--text);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.analytics-row time { color: var(--subtle); font-size: 12px; }

.admin-analytics .notice { margin: 10px; padding: 11px 13px; border-radius: 7px; font-size: 13px; }

.admin-log { padding: 20px; background: rgba(34, 33, 39, .28); }

.admin-log h2 { margin: 0 0 14px; font-size: 20px; line-height: 1.2; }

.admin-log__list {
    max-height: 360px;
    overflow: auto;
    display: grid;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .1) transparent;
}

.admin-log__row {
    display: grid;
    grid-template-columns: 150px 120px 80px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: rgba(42, 41, 49, .48);
    color: var(--muted);
    font-size: 13px;
}

.admin-log__row strong { color: var(--text); }

/* =============================================
   ADMIN RESPONSIVE
   ============================================= */
@media (max-width: 820px) {
    .admin-panel__header { flex-wrap: wrap; }
    .admin-panel__actions { flex-wrap: wrap; justify-content: flex-start; }

    .admin-viewer__header,
    .admin-analytics__header { align-items: flex-start; flex-direction: column; }

    .analytics-grid,
    .admin-layout,
    .admin-security,
    .analytics-split { grid-template-columns: 1fr; }

    /* Список комнат — сверху, просмотр — снизу */
    .admin-list { border-right: 0; border-bottom: 1px solid var(--line); max-height: 320px; }
    .admin-messages { max-height: none; }
    .admin-log__row { grid-template-columns: 1fr; }
    .analytics-row,
    .analytics-row--compact { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    /* Статус-бар — компактнее, live прячем */
    .status-bar { padding: 10px 14px; gap: 2px; }
    .status-bar__item { padding: 0 6px; }
    .status-bar__value { font-size: 15px; }
    .status-bar__live { display: none; }

    /* Табы — иконки + текст, скролл */
    .seg-tabs { padding: 10px 14px 0; }
    .seg-tabs__item { padding: 9px 12px 10px; }

    .admin-panel__header { padding: 14px 16px; }
    .admin-viewer__header { padding: 14px 16px; }
    .admin-viewer__ban-input { width: 100px; }
}

/* =============================================================
   ANON CHAT START CLEAN
   ============================================================= */
.anon-chat-page {
    background:
        radial-gradient(circle at 16% 35%, rgba(0, 151, 255, .16), transparent 34%),
        radial-gradient(circle at 84% 18%, rgba(0, 101, 255, .12), transparent 30%),
        linear-gradient(135deg, #030812 0%, #071121 45%, #020711 100%);
    isolation: isolate;
}

.anon-chat-page::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        linear-gradient(rgba(37, 138, 255, .045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 138, 255, .045) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(circle at 50% 38%, #000 0, transparent 72%);
}

.site-top {
    width: min(1180px, calc(100% - 40px));
    margin: 16px auto 0;
    border: 0;
    border-radius: 15px;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    z-index: 4;
}

.site-top__inner { min-height: 62px; padding: 8px 18px; }
.brand { gap: 10px; min-width: 0; }
.brand::before {
    content: "";
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, rgba(0,229,255,.98), rgba(35,103,255,.94));
    clip-path: polygon(12% 15%, 50% 2%, 88% 15%, 88% 56%, 50% 98%, 12% 56%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.32);
}
.brand strong { font-size: 21px; letter-spacing: .01em; line-height: 1; }
.brand span { padding: 5px 9px; border-radius: 8px; font-size: 12px; }
.site-top__actions { gap: 8px; }
.site-link { min-height: 36px; padding: 0 15px; border-radius: 9px; font-size: 13px; }

.site-nav { display: none; }
.site-nav .site-container { width: 100%; min-height: 24px; padding: 0 4px; }
.site-nav a { font-size: 13px; color: rgba(184,199,220,.72); }

.shell { width: min(1180px, calc(100% - 40px)); min-height: calc(100vh - 92px); padding-top: 0; z-index: 2; }
#startView.hero { border: 0; background: transparent; box-shadow: none; overflow: visible; }
#startView .hero__content {
    width: 100%;
    padding: clamp(4px, 1.3vw, 16px) 0 clamp(16px, 2.4vw, 30px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(420px, 500px);
    gap: clamp(32px, 4vw, 58px);
    align-items: center;
    text-align: left;
}

.hero__intro { position: relative; min-height: 0; padding: 18px 0 22px; overflow: visible; display: flex; flex-direction: column; align-items: center; text-align: center; }
.digital-print {
    position: fixed;
    left: -425px;
    top: 50vh;
    width: 1615px;
    height: 1462px;
    transform: translateY(-50%);
    transform-origin: left center;
    z-index: 1;
    pointer-events: none;
    opacity: .96;
    overflow: visible;
    font-family: "SF Mono", Consolas, "Liberation Mono", monospace;
    filter: drop-shadow(0 0 34px rgba(0, 157, 255, .16));
    mask-image:
        radial-gradient(ellipse at 36% 50%, #000 0 48%, rgba(0,0,0,.78) 62%, transparent 78%),
        linear-gradient(90deg, #000 0%, #000 64%, rgba(0,0,0,.55) 82%, transparent 100%);
}
.digital-print pre {
    margin: 0;
    position: absolute;
    white-space: pre;
    user-select: none;
    font-size: 19px;
    line-height: 1.08;
    letter-spacing: .01em;
    transform-origin: 42% 50%;
    will-change: transform, opacity;
}
.digital-print__stars {
    left: -30px;
    top: -120px;
    color: rgba(226, 241, 255, .42);
    font-size: 10px;
    line-height: 1.2;
    opacity: .07;
    animation: digitalStarsDrift 18s linear infinite, digitalStarsBlink 8s ease-in-out infinite;
}
.digital-print__stars--near {
    left: 30px;
    top: -60px;
    font-size: 12px;
    opacity: .1;
    animation-duration: 13s, 6s;
    animation-delay: -3s, -1s;
}
.digital-print__surface,
.digital-print__reveal,
.digital-print__storm {
    position: absolute;
    left: 105px;
    top: 119px;
    color: rgba(235, 242, 248, .82);
    text-shadow: 0 0 11px rgba(0, 175, 255, .18);
}
.digital-print__surface {
    opacity: .96;
    animation: none;
}
.digital-print__surface-grid {
    width: 52ch;
    height: 47em;
    font-size: 19px;
    line-height: 1.08;
    letter-spacing: .01em;
}
.digital-print__surface-grid span {
    position: absolute;
    opacity: 0;
    color: rgba(196, 218, 235, .56);
    /* Без тени у каждой ячейки: их больше тысячи, и мягкое свечение считалось
       для каждой отдельно — страница проседала до 24 кадров в секунду. Общее
       свечение даёт слой .digital-print__glow ниже. */
    animation: digitalCellLoad .46s ease-out var(--delay, .2s) forwards;
}
.digital-print__surface-grid span.is-hot {
    color: rgba(255, 142, 58, .5);
}
.digital-print__reveal {
    color: rgba(104, 211, 255, .72);
    opacity: .28;
    animation: digitalReveal 3.1s ease-in-out infinite;
    animation-delay: calc(2.15s + var(--delay, 0s));
}
.digital-print__reveal--warm {
    color: rgba(255, 143, 54, .68);
    text-shadow: 0 0 12px rgba(255, 118, 40, .24);
}
.digital-print__storm {
    color: rgba(118, 218, 255, .62);
    opacity: 1;
    left: 105px;
    top: 119px;
    animation: none;
}
.digital-print__storm-cells {
    width: 52ch;
    height: 47em;
    font-size: 19px;
    line-height: 1.08;
    letter-spacing: .01em;
}
.digital-print__storm-cells span {
    position: absolute;
    opacity: 0;
    color: rgba(118, 218, 255, .58);
    animation: digitalStormA var(--duration, 5.4s) linear infinite;
    animation-delay: calc(1.9s + var(--delay, 0s));
    will-change: transform, opacity;
}
.digital-print__storm-cells span::after {
    content: attr(data-tail);
    position: absolute;
    left: -.72em;
    top: .08em;
    opacity: .34;
    color: inherit;
}
.digital-print__storm-cells span.digital-print__particle--1 {
    animation-name: digitalStormB;
    animation-timing-function: linear;
}
.digital-print__storm-cells span.digital-print__particle--2 {
    animation-name: digitalStormC;
    animation-timing-function: linear;
}
.digital-print__storm-cells span.is-warm {
    color: rgba(255, 155, 72, .55);
    text-shadow: 0 0 10px rgba(255, 118, 40, .18);
}
.hero__intro::before {
    content: "";
    position: absolute;
    width: 470px;
    aspect-ratio: 1;
    left: -120px;
    top: 48%;
    transform: translateY(-50%) scale(.42);
    border-radius: 50%;
    opacity: .54;
    z-index: -1;
    background:
        repeating-radial-gradient(circle, rgba(0,156,255,.045) 0 18px, transparent 19px 24px, rgba(58,181,255,.24) 25px 26px, transparent 27px 52px),
        radial-gradient(circle, rgba(0,177,255,.1), transparent 68%);
    animation: anonRadarRings 3.2s linear infinite;
}
.hero__intro::after {
    content: "";
    position: absolute;
    width: 470px;
    height: 470px;
    left: -120px;
    top: 48%;
    transform: translateY(-50%) scale(.18);
    border-radius: 50%;
    border: 0;
    background:
        repeating-radial-gradient(circle, rgba(0,156,255,.035) 0 17px, transparent 18px 24px, rgba(66,204,255,.19) 25px 26px, transparent 27px 52px),
        radial-gradient(circle, rgba(0,177,255,.08), transparent 70%);
    opacity: .48;
    z-index: -1;
    animation: anonRadarRings 3.2s linear infinite .9s;
}
#startView .hero__head { padding-left: 0; }
#startView .hero__head,
#startView .hero__badges,
.hero__panel {
    position: relative;
    z-index: 2;
}
#startView .eyebrow {
    width: max-content;
    margin-left: auto;
    margin-right: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #43c7ff;
    font-size: 12px;
    letter-spacing: .11em;
    box-shadow: none;
    text-shadow: 0 0 14px rgba(0, 184, 255, .34);
}
#startView h1 { max-width: none; margin: 18px auto 0; font-size: clamp(40px, 3.8vw, 54px); line-height: 1.08; color: #fff; white-space: nowrap; }
#startView h1 span { color: #87dbff; text-shadow: 0 0 18px rgba(0,180,255,.2); }
#startView .lead { max-width: 500px; margin: 16px auto 0; color: rgba(199,212,230,.82); font-size: 17px; line-height: 1.55; }

#startView .hero__badges { width: auto; margin-top: 30px; padding-left: 0; display: flex; flex-wrap: nowrap; justify-content: center; gap: 10px; }
#startView .hero__badges li {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0 13px;
    border: 1px solid rgba(82,172,255,.24);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(5,24,53,.54), rgba(3,12,29,.34));
    color: rgba(232,243,255,.92);
    white-space: nowrap;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 8px 22px rgba(0,0,0,.12);
}
#startView .hero__badges li::before { display: none; }
#startView .hero__badges svg { width: 16px; height: 16px; flex: 0 0 16px; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#startView .hero__badges li:nth-child(1) { border-color: rgba(48,210,255,.28); }
#startView .hero__badges li:nth-child(2) { border-color: rgba(75,145,255,.3); }
#startView .hero__badges li:nth-child(3) { border-color: rgba(68,229,190,.26); }
#startView .hero__badges li:nth-child(4) { border-color: rgba(92,205,255,.28); }
#startView .hero__badges li:nth-child(1) svg { stroke: #42d6ff; }
#startView .hero__badges li:nth-child(2) svg { stroke: #5ca7ff; }
#startView .hero__badges li:nth-child(3) svg { stroke: #55e5c1; }
#startView .hero__badges li:nth-child(4) svg { stroke: #72caff; }
#startView .hero__badges span { display: block; line-height: 1; font-size: 12px; font-weight: 800; }

@keyframes anonRadarRings {
    0% {
        transform: translateY(-50%) scale(.18);
        opacity: .62;
    }
    100% {
        transform: translateY(-50%) scale(1.08);
        opacity: 0;
    }
}

@keyframes digitalSurfaceBreathe {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    45% { transform: translate3d(2px, -3px, 0) scale(1.018); }
}

@keyframes digitalCellLoad {
    0% { opacity: 0; transform: translate3d(0, 2px, 0) scale(.92); }
    100% { opacity: var(--cell-opacity, .62); transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes digitalReveal {
    0%, 100% { opacity: .02; transform: translate3d(0, 0, 0) scale(.995); }
    22% { opacity: .34; transform: translate3d(1px, -1px, 0) scale(1.004); }
    54% { opacity: .08; }
}

@keyframes digitalStormA {
    0% { opacity: 0; transform: translate3d(0, 0, 0) scale(.94) rotate(0deg); }
    9% { opacity: .3; transform: translate3d(var(--x1, 18px), var(--y1, -8px), 0) scale(.98) rotate(calc(var(--rot, 4deg) * .25)); }
    42% { opacity: .22; transform: translate3d(var(--x2, 58px), var(--y2, -22px), 0) scale(var(--mid-scale, 1)) rotate(var(--rot, 4deg)); }
    74% { opacity: .08; transform: translate3d(var(--x4, 90px), var(--y4, -34px), 0) scale(.96) rotate(calc(var(--rot, 4deg) * 1.35)); }
    100% { opacity: 0; transform: translate3d(var(--x3, 120px), var(--y3, -44px), 0) scale(var(--end-scale, .9)) rotate(calc(var(--rot, 4deg) * 1.7)); }
}

@keyframes digitalStormB {
    0% { opacity: 0; transform: translate3d(0, 0, 0) scale(.9) rotate(0deg); }
    12% { opacity: .24; transform: translate3d(var(--x1, 18px), var(--y1, -8px), 0) scale(.98) rotate(calc(var(--rot, 4deg) * -.2)); }
    48% { opacity: .2; transform: translate3d(var(--x2, 58px), var(--y2, -22px), 0) scale(1.03) rotate(calc(var(--rot, 4deg) * .75)); }
    76% { opacity: .07; transform: translate3d(var(--x4, 90px), var(--y4, -34px), 0) scale(.98) rotate(var(--rot, 4deg)); }
    100% { opacity: 0; transform: translate3d(var(--x3, 120px), var(--y3, -44px), 0) scale(var(--end-scale, .9)) rotate(calc(var(--rot, 4deg) * 1.35)); }
}

@keyframes digitalStormC {
    0% { opacity: 0; transform: translate3d(0, 0, 0) scale(.96) rotate(0deg); }
    6% { opacity: .34; transform: translate3d(var(--x1, 18px), var(--y1, -8px), 0) scale(1.04) rotate(calc(var(--rot, 4deg) * .15)); }
    32% { opacity: .19; transform: translate3d(var(--x2, 58px), var(--y2, -22px), 0) scale(.96) rotate(calc(var(--rot, 4deg) * .9)); }
    68% { opacity: .07; transform: translate3d(var(--x4, 90px), var(--y4, -34px), 0) scale(.92) rotate(calc(var(--rot, 4deg) * 1.4)); }
    100% { opacity: 0; transform: translate3d(var(--x3, 120px), var(--y3, -44px), 0) scale(var(--end-scale, .9)) rotate(calc(var(--rot, 4deg) * 2)); }
}

@keyframes digitalStarsDrift {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-80px, 0, 0); }
}

@keyframes digitalStarsBlink {
    0%, 100% { opacity: .05; }
    50% { opacity: .16; }
}

.hero__panel {
    width: min(500px, 100%);
    justify-self: end;
    align-self: center;
    border: 1px solid rgba(76, 201, 255, .3);
    border-radius: 22px;
    padding: 24px;
    background:
        linear-gradient(145deg, rgba(20, 28, 56, .82), rgba(10, 14, 30, .9)),
        radial-gradient(circle at 18% 0, rgba(76, 201, 255, .16), transparent 34%);
    box-shadow: 0 20px 60px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.035) inset, 0 0 40px rgba(76, 201, 255, .14);
}
.hero__panel::before { display: none; }
.hero__panel-head { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 12px; margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid rgba(76, 201, 255, .14); }
.hero__panel-head strong { display: block; color: #f4f8ff; font-size: 18px; line-height: 1.2; }
.hero__panel-head small { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; font-weight: 400; }
.hero__panel-mark { position: static; width: 28px; height: 28px; display: grid; place-items: center; color: var(--accent); background: transparent; box-shadow: none; border: 0; }
.hero__panel-mark svg { width: 24px; height: 24px; }

#startView .create-option { width: 100%; min-height: 82px; margin: 0; padding: 16px; display: grid; grid-template-columns: 42px minmax(0, 1fr) 48px; align-items: center; gap: 14px; border-radius: 14px; border-color: rgba(76, 201, 255, .18); background: linear-gradient(180deg, rgba(18, 30, 58, .6), rgba(10, 18, 38, .65)); box-shadow: 0 10px 28px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.045); }
#startView .room-password-create { width: 100%; max-width: none; justify-self: stretch; }
#startView .create-option + .room-password-create { margin-top: 12px; }
.create-option__icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--accent); background: rgba(76, 201, 255, .12); box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
.create-option__icon svg { width: 21px; height: 21px; }
#startView .create-option strong { color: #f3f7ff; font-size: 15px; line-height: 1.22; font-weight: 800; }
#startView .create-option small { display: block; margin-top: 4px; color: var(--subtle); font-size: 13px; line-height: 1.35; font-weight: 400; }
#startView .create-option input[type="checkbox"] { appearance: none; -webkit-appearance: none; box-sizing: border-box; position: relative; width: 46px; height: 26px; min-height: 26px; margin: 0; padding: 0; border: 1px solid rgba(120, 160, 220, .28); border-radius: 9px; background: linear-gradient(180deg, rgba(15, 23, 44, .98), rgba(8, 12, 24, .98)); box-shadow: inset 0 0 0 2px rgba(65,93,134,.14); cursor: pointer; }
#startView .create-option input[type="checkbox"]::before { content: ""; display: block; box-sizing: border-box; width: 18px; height: 18px; margin: 3px; border-radius: 6px; background: linear-gradient(180deg, #dbe6f5, #9caac0); box-shadow: 0 3px 9px rgba(0,0,0,.34); transform: translateX(0); transition: transform .18s ease, background .18s ease; }
#startView .create-option input[type="checkbox"]:checked { border-color: rgba(76, 201, 255, .64); background: linear-gradient(135deg, var(--accent), var(--accent-strong)); box-shadow: inset 0 1px 0 rgba(255,255,255,.2); }
#startView .create-option input[type="checkbox"]:checked::before { transform: translateX(20px); background: #f8fbff; }

#startView .password-row { margin: 12px 0 0; padding: 12px; border: 1px solid rgba(76, 201, 255, .22); border-radius: 14px; background: rgba(10, 14, 30, .65); }
#startView .actions { margin-top: 16px; display: grid; grid-template-columns: 1fr; gap: 10px; }
#startView .button { min-height: 50px; border-radius: 12px; font-size: 16px; }
#startView .button--ghost { min-height: 46px; color: var(--muted); border-color: rgba(76, 201, 255, .4); background: rgba(10, 16, 32, .55); box-shadow: inset 0 1px 0 rgba(255,255,255,.045); }
#startView .button--ghost:hover { color: #fff; background: rgba(76, 201, 255, .14); }

/* ВАЖНО: скрывает только под html.reveal-ready, то есть когда reveal.js
   действительно взялся анимировать. Раньше правило висело на самом
   [data-reveal], и содержимое было невидимым ПО УМОЛЧАНИЮ: стоило скрипту не
   отработать (ошибка, наблюдатель не сработал на только что показанной секции)
   — и стартовый экран оставался пустой картинкой без текста и кнопки. */
html.reveal-ready [data-reveal] {
    opacity: 0;
    transform: translate3d(var(--reveal-x, 0), var(--reveal-y, 18px), 0) scale(.985);
    transition:
        opacity .62s ease,
        transform .74s cubic-bezier(.16, 1, .3, 1),
        filter .74s cubic-bezier(.16, 1, .3, 1);
    transition-delay: var(--reveal-delay, 0ms);
    will-change: opacity, transform, filter;
}

[data-reveal="left"] { --reveal-x: -34px; --reveal-y: 0; }
[data-reveal="right"] { --reveal-x: 34px; --reveal-y: 0; }
[data-reveal="down"] { --reveal-x: 0; --reveal-y: -16px; }
[data-reveal="up"] { --reveal-x: 0; --reveal-y: 20px; }

html.reveal-ready [data-reveal].is-revealed {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
}

.composer__field { align-items: center; padding: 6px 6px 6px 14px; }
.composer__input { flex: 1 1 auto; min-width: 0; min-height: 38px; max-height: 118px; overflow-y: auto; padding: 9px 4px; border: 0; outline: none; background: transparent; color: var(--text); line-height: 1.35; white-space: pre-wrap; word-break: break-word; scrollbar-width: thin; }
.composer__input:focus, .composer__input:focus-visible { outline: none; box-shadow: none; }
.composer__input:empty::before { content: attr(data-placeholder); color: var(--subtle); pointer-events: none; }
.composer__field:focus-within { border-color: rgba(69,202,255,.38); box-shadow: none; }

@media (max-width: 980px) {
    #startView .hero__content { grid-template-columns: 1fr; }
    .hero__panel { justify-self: stretch; width: 100%; }
}

@media (max-width: 720px) {
    .site-top, .site-nav, .shell { width: calc(100% - 20px); }
    .site-top__inner { min-height: 58px; padding: 8px 12px; }
    #startView .hero__content { text-align: center; }
    .hero__intro { padding-top: 8px; }
    #startView .hero__head { padding-left: 0; }
    #startView .eyebrow { margin-left: auto; margin-right: auto; }
    #startView h1 { white-space: normal; text-align: center; font-size: clamp(34px, 10vw, 46px); }
    #startView .lead { margin-left: auto; margin-right: auto; text-align: center; max-width: 94%; }
    #startView .hero__badges {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: min(420px, 100%);
        margin-left: auto;
        margin-right: auto;
        padding-left: 0;
        gap: 10px;
    }
    #startView .hero__badges li { min-height: 48px; justify-content: center; padding: 0 10px; gap: 7px; }
    #startView .hero__badges span { white-space: normal; text-align: center; line-height: 1.12; font-size: 11.5px; }
    .digital-print {
        left: -515px;
        opacity: .34;
        transform: translateY(-50%);
        filter: drop-shadow(0 0 18px rgba(0, 157, 255, .08));
        mask-image:
            radial-gradient(ellipse at 28% 50%, rgba(0,0,0,.78) 0 42%, rgba(0,0,0,.36) 58%, transparent 76%),
            linear-gradient(90deg, rgba(0,0,0,.65) 0%, rgba(0,0,0,.5) 42%, transparent 74%);
    }
    .digital-print__stars { opacity: .035; }
    .digital-print__stars--near { opacity: .045; }
    .digital-print__surface-grid span { --cell-opacity: .36; color: rgba(180, 210, 232, .34); }
    .digital-print__stars,
    .digital-print__reveal,
    .digital-print__storm {
        display: none;
    }
    .digital-print__surface {
        animation: none;
    }
    .digital-print__surface-grid span {
        animation: none;
        opacity: .26;
        text-shadow: none;
        will-change: auto;
    }
}

@media (max-width: 640px) {
    .hero__panel { padding: 18px 14px; }
    .hero__panel-head { grid-template-columns: 40px minmax(0, 1fr); gap: 12px; }
    .hero__panel-mark { width: 40px; height: 40px; }
    #startView .create-option { grid-template-columns: 38px minmax(0, 1fr) 46px; padding: 14px; gap: 12px; }
    .create-option__icon { width: 38px; height: 38px; }
    .composer__field { padding: 5px 5px 5px 12px; }
    .composer__input { min-height: 36px; padding: 8px 3px; }
}

@media (prefers-reduced-motion: reduce) {
    [data-reveal] {
        opacity: 1;
        transform: none;
        filter: none;
        transition: none;
        will-change: auto;
    }
    /* Гасим неоновые анимации и микро-анимации для слабых устройств/доступности */
    .message { animation: none !important; }
    .chat__ttlfill[data-tier="low"] { animation: none !important; }
    .status__dot[data-mode="ok"] { animation: none !important; }
    .digital-print, .digital-print pre, .digital-print__stars,
    .digital-print__reveal, .digital-print__storm, .digital-print__surface-grid span {
        animation: none !important;
    }
    .composer__send, .kpi-card, .button--primary { transition: none !important; }
}

/* =============================================
   ФОН СТРАНИЦЫ
   Картинка в проекте одна — та же, что на стартовом экране.
   Здесь она сильно затемнена: поверх неё идёт интерфейс чата.
   ============================================= */

body.anon-chat-page {
    background:
        linear-gradient(rgba(2, 6, 17, .93), rgba(2, 6, 17, .97)),
        url("../img/start-hero.jpg") center center / cover no-repeat fixed,
        rgb(2, 6, 17);
}

/* =============================================================
   ПЕРЕКЛЮЧАТЕЛЬ ТЕМЫ
   Одна и та же кнопка в двух местах: в шапке чата и плавающая на
   стартовых экранах. Иконку выбирает тема.
   ============================================================= */

.theme-ico { width: 19px; height: 19px; stroke: currentColor; }
.theme-ico--sun { display: none; }
html[data-theme="light"] .theme-ico--moon { display: none; }
html[data-theme="light"] .theme-ico--sun { display: block; }

.theme-fab {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 5;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 50%;
    background: rgba(2, 6, 17, .55);
    color: #ffd9a8;
    cursor: pointer;
    backdrop-;
    transition: background .18s ease, border-color .18s ease, color .18s ease;
}

.theme-fab:hover {
    background: rgba(255, 123, 0, .3);
    border-color: rgba(255, 179, 71, .5);
    color: #fff;
}

.language-fab {
    position: fixed;
    top: 23px;
    right: 70px;
    z-index: 6;
    min-width: 30px;
    height: 28px;
    padding: 0 3px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: rgba(255, 230, 194, .92);
    font: inherit;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    cursor: pointer;
    text-shadow: 0 1px 8px rgba(0, 0, 0, .7);
    transition: color .18s ease, transform .18s ease, text-shadow .18s ease;
}

.language-fab:hover,
.language-fab:focus-visible {
    border: 0;
    background: transparent;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 207, 139, .75);
    transform: translateY(-1px);
}

.icon-btn--language {
    width: 30px;
    min-width: 30px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: rgba(255, 230, 194, .9);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .07em;
    text-shadow: 0 1px 7px rgba(0, 0, 0, .65);
}

.icon-btn--language:hover,
.icon-btn--language:focus-visible {
    border: 0;
    background: transparent;
    color: #fff;
    text-shadow: 0 0 9px rgba(255, 207, 139, .7);
}

.bookmark-help { display: grid; gap: 20px; }
.bookmark-help p { margin: 0; color: var(--muted); line-height: 1.65; }
.bookmark-help .button { justify-self: start; }

/* В чате такая же кнопка стоит в шапке — плавающая там лишняя. */
body[data-page="chat"] .theme-fab { display: none; }
body[data-page="chat"] .language-fab { display: none; }

/* Если задан ANON_HOME_URL, в правом верхнем углу стоит ссылка «на сайт» —
   опускаем кнопку темы, чтобы они не наезжали друг на друга. */
body:has(.site-top) .theme-fab { top: 70px; }
body:has(.site-top) .language-fab { top: 77px; }

/* =============================================================
   КАРТИНКИ В ПЕРЕПИСКЕ
   ============================================================= */

/* Скрытое поле выбора файла: скрепка нажимает на него программно. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.message__shot {
    display: block;
    max-width: min(320px, 100%);
    margin: 2px 0 0;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    line-height: 0;
}

.message--mine .message__shot {
    margin-left: auto;
}

/* height:auto обязателен: у <img> стоят width/height с сервера, чтобы лента не
   дёргалась при загрузке, и без этого картинка растянулась бы по вертикали. */
.message__shot img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 0;
    transition: opacity .15s ease;
}

.message__shot:hover img { opacity: .94; }

/* Файл тянут в окно — показываем, что здесь его ждут. */
.chat.is-dropping {
    outline: 2px dashed var(--accent);
    outline-offset: -6px;
}

/* Кнопка только с иконкой — рядом с полем пароля. Ширина по высоте, чтобы
   получился аккуратный квадрат, а не растянутая кнопка с пустотой внутри. */
.button--icon {
    padding: 0;
    width: 38px;
    min-width: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.button--icon svg {
    width: 17px;
    height: 17px;
}

/* =============================================================================
   ПОДВАЛ СТАРТОВОГО ЭКРАНА
   Три колонки: знак с описанием, разделы, помощь. Ниже узкая полоса с подписью.
   ============================================================================= */

.site-foot {
    position: relative;
    z-index: 2;
    border-top: 1px solid var(--line-soft, rgba(255, 255, 255, .08));
    background: transparent;
    color: var(--muted, rgba(255, 255, 255, .8));
    font-size: 13px;
    line-height: 1.5;
}

.site-foot__inner { padding: 26px 0 16px; }

.site-foot__cols {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr));
    gap: 24px 36px;
    align-items: start;
}

.site-foot__brand {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.site-foot__logo {
    width: clamp(76px, 8vw, 104px);
    height: auto;
    flex-shrink: 0;
    display: block;
}

.site-foot__brand-text {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.site-foot__brand-text strong {
    color: var(--text, #fff);
    font-size: calc(12px * var(--ui));
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.site-foot__brand-text span {
    font-size: calc(13px * var(--ui));
    color: var(--subtle, rgba(255, 255, 255, .66));
    max-width: 46ch;
}

/* Колонка ссылок: заголовок и вертикальный список. */
.site-foot__col {
    display: grid;
    gap: 8px;
    justify-items: start;
}

.site-foot__col h2 {
    margin: 0 0 2px;
    color: var(--text, #fff);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
}

/* Ссылка и кнопка выглядят одинаково: часть пунктов открывает модальное окно,
   часть ведёт по адресу, и разница в теге не должна быть заметна. */
.site-foot__link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted, rgba(255, 255, 255, .78));
    font: inherit;
    font-size: calc(13px * var(--ui));
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: color .15s;
}

.site-foot__link:hover,
.site-foot__link:focus-visible { color: var(--text, #fff); }

.project-share {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--muted, rgba(255, 255, 255, .78));
    font-size: calc(13px * var(--ui));
}

.project-share__label {
    cursor: default;
    transition: color .2s ease;
}

.project-share:hover .project-share__label,
.project-share:focus-within .project-share__label { color: var(--text, #fff); }

.project-share__icons {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 0;
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
    transition: max-width .38s cubic-bezier(.22, 1, .36, 1) .26s,
                visibility 0s linear .64s;
}

.project-share:hover .project-share__icons,
.project-share:focus-within .project-share__icons {
    max-width: 110px;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
}

.project-share__icon {
    width: 29px;
    height: 29px;
    padding: 0;
    border: 1px solid rgba(255, 207, 139, .2);
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 179, 71, .055);
    color: rgba(255, 220, 171, .82);
    text-decoration: none;
    cursor: pointer;
    opacity: 0;
    transform: translateX(-8px) scale(.84);
    transition: color .16s ease, border-color .16s ease, background .16s ease,
                opacity .2s ease, transform .3s cubic-bezier(.22, 1, .36, 1);
}

.project-share__icon:nth-child(1) { transition-delay: 0s, 0s, 0s, .14s, .14s; }
.project-share__icon:nth-child(2) { transition-delay: 0s, 0s, 0s, .07s, .07s; }
.project-share__icon:nth-child(3) { transition-delay: 0s; }

.project-share:hover .project-share__icon,
.project-share:focus-within .project-share__icon {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.project-share:hover .project-share__icon:nth-child(1),
.project-share:focus-within .project-share__icon:nth-child(1) { transition-delay: 0s, 0s, 0s, .05s, .05s; }
.project-share:hover .project-share__icon:nth-child(2),
.project-share:focus-within .project-share__icon:nth-child(2) { transition-delay: 0s, 0s, 0s, .12s, .12s; }
.project-share:hover .project-share__icon:nth-child(3),
.project-share:focus-within .project-share__icon:nth-child(3) { transition-delay: 0s, 0s, 0s, .19s, .19s; }

.project-share__icon svg {
    width: 15px;
    height: 15px;
    display: block;
    fill: currentColor;
}

.project-share__icon--copy svg { fill: none; }

.project-share__icon:hover,
.project-share__icon:focus-visible {
    outline: 0;
    border-color: rgba(255, 207, 139, .52);
    background: rgba(255, 179, 71, .13);
    color: #fff;
    transform: translateY(-1px);
}

.project-share__icon--telegram:hover { color: #8ddcff; }
.project-share__icon--vk:hover { color: #a9c9f5; }
.project-share__icon--copy.is-copied { border-color: rgba(88, 231, 185, .62); color: #8ff0d0; }
.project-share__icon--copy.is-copy-error { border-color: rgba(255, 122, 122, .6); color: #ffc0c0; }

.site-foot__bar {
    margin-top: 20px;
    padding-top: 12px;
    border-top: 1px solid var(--line-soft, rgba(255, 255, 255, .07));
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 6px 18px;
}

.site-foot__legal,
.site-foot__note {
    margin: 0;
    font-size: calc(11px * var(--ui));
    color: var(--subtle, rgba(255, 255, 255, .52));
}

@media (max-width: 900px) {
    .site-foot__inner { padding: 20px 0 14px; }
    .site-foot__cols { grid-template-columns: minmax(0, 1fr); gap: 18px; }
    .site-foot__logo { width: 64px; }
    .site-foot__brand-text span { display: none; }
    .site-foot__bar { margin-top: 14px; }
}

/* =============================================================================
   МОДАЛЬНОЕ ОКНО
   Простое и тихое: ровная подложка, прямоугольник со скруглением, заголовок,
   список, крестик. Ни свечения, ни размытия, ни движения — окно должно молча
   показать текст и закрыться.
   ============================================================================= */

.modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 4vw, 40px);
}

.modal[hidden] { display: none; }

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 9, 16, .74);
}

.modal__window {
    position: relative;
    z-index: 1;
    width: min(520px, 100%);
    max-height: min(82vh, 820px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 14px;
    background: #12161f;
}

.modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 18px 12px 20px;
}

.modal__title {
    flex: 1 1 auto;
    margin: 0;
    font-size: calc(16px * var(--ui));
    font-weight: 600;
    line-height: 1.3;
    color: var(--text, #fff);
}

.modal__back,
.modal__close {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border: 0;
    border-radius: 8px;
    background: none;
    color: rgba(255, 255, 255, .58);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color .15s, background .15s;
}

.modal__back[hidden] { display: none; }
.modal__back svg { width: 16px; height: 16px; }
.modal__back:hover,
.modal__back:focus-visible { color: #fff; background: rgba(255, 255, 255, .08); }

.modal__close {
    color: rgba(255, 255, 255, .58);
}

.modal__close svg { width: 14px; height: 14px; }
.modal__close:hover { color: #fff; background: rgba(255, 255, 255, .08); }

.modal__body {
    padding: 0 20px 20px;
    overflow: auto;
    scrollbar-color: rgba(255, 179, 71, .55) rgba(255, 255, 255, .06);
    scrollbar-width: thin;
    color: rgba(255, 255, 255, .78);
    font-size: calc(14px * var(--ui));
    line-height: 1.6;
}

/* Список без карточек и галочек: строки, разделённые тонкой линией. */
.modal-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.modal-list li {
    padding: 11px 0;
    border-top: 1px solid rgba(255, 255, 255, .07);
}

.modal-list li:first-child { border-top: 0; padding-top: 4px; }
.modal-list li:last-child { padding-bottom: 0; }

.modal-shot {
    display: grid;
    gap: 12px;
    justify-items: center;
}

.modal-shot img {
    max-width: 100%;
    max-height: 68vh;
    border-radius: 10px;
    display: block;
}

.modal-shot__link {
    color: rgba(255, 255, 255, .6);
    font-size: 12px;
    text-decoration: none;
}

.modal-shot__link:hover { color: #fff; }

.modal--wide .modal__window {
    width: min(820px, 100%);
    max-height: min(90dvh, 850px);
}

@media (max-width: 900px) {
    .modal--wide { padding: 16px; }
}

@media (max-width: 520px) {
    .modal { padding: 12px; }
    .modal__window { max-height: calc(100dvh - 24px); }
}

/* Лёгкий просмотр поверх чата: фон не затемняется, изображение видно целиком. */
.modal--gallery { padding: clamp(12px, 3vw, 36px); }

.modal--gallery .modal__backdrop { background: transparent; }

.modal--gallery .modal__window {
    width: auto;
    height: auto;
    max-width: calc(100vw - clamp(24px, 6vw, 72px));
    max-height: none;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    animation: media-viewer-appear .2s cubic-bezier(.2, .75, .25, 1) both;
}

.modal--gallery .modal__head {
    position: absolute;
    z-index: 4;
    top: 10px;
    right: 10px;
    padding: 0;
}

.modal--gallery .modal__title { display: none; }

.modal--gallery .modal__close {
    width: 34px;
    height: 34px;
    border-radius: 0;
    background: transparent;
    color: rgba(255, 255, 255, .82);
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .75));
}

.modal--gallery .modal__close:hover { background: rgba(0, 0, 0, .24); }

.modal--gallery .modal__body {
    width: auto;
    height: auto;
    min-height: 0;
    padding: 0;
    overflow: visible;
}

.media-viewer {
    position: relative;
    width: fit-content;
    height: auto;
    min-height: 0;
    display: grid;
    justify-items: center;
}

.media-viewer__stage {
    position: relative;
    min-height: 0;
    overflow: hidden;
    border-radius: 0;
    box-shadow: none;
}

.media-viewer__canvas {
    width: fit-content;
    height: auto;
    padding: 0;
    overflow: hidden;
    touch-action: none;
    cursor: zoom-in;
}

.media-viewer__canvas.is-zoomed { cursor: grab; }
.media-viewer__canvas.is-zoomed:active { cursor: grabbing; }

.media-viewer__image {
    width: auto;
    height: auto;
    max-width: min(86vw, 1280px);
    max-height: min(calc(82dvh - 58px), 760px);
    display: block;
    object-fit: contain;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    user-select: none;
    transform-origin: center;
    transition: transform .16s ease;
}

.media-viewer__canvas.is-zoomed .media-viewer__image { transition: none; }

.media-viewer__nav {
    position: absolute;
    z-index: 2;
    top: 50%;
    width: 46px;
    height: 58px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: rgba(8, 12, 18, .66);
    color: #fff;
    font-size: 40px;
    font-weight: 200;
    line-height: 1;
    cursor: pointer;
    transform: translateY(-50%);
    transition: background .15s ease, transform .15s ease;
}

.media-viewer__nav:hover { background: rgba(30, 39, 50, .92); }
.media-viewer__nav--prev { left: 14px; }
.media-viewer__nav--next { right: 14px; }
.media-viewer__nav[hidden] { display: none; }

.media-viewer__bar {
    z-index: 3;
    display: flex;
    align-items: center;
    margin-top: 8px;
    padding: 6px;
    border: 0;
    border-radius: 8px;
    background: rgba(12, 17, 24, .78);
    box-shadow: none;
}

.media-viewer__tools { display: flex; align-items: center; gap: 6px; }

.media-viewer__tool,
.media-viewer__original {
    min-width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 0;
    border-radius: 9px;
    background: rgba(255, 255, 255, .07);
    color: rgba(255, 255, 255, .82);
    font: inherit;
    font-size: 13px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}

.media-viewer__tool:hover,
.media-viewer__original:hover { background: rgba(255, 255, 255, .13); color: #fff; }
.media-viewer__zoom { min-width: 58px; font-variant-numeric: tabular-nums; }

@keyframes media-viewer-appear {
    from { opacity: 0; transform: translateY(8px) scale(.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .modal--gallery .modal__window { animation: none; }
    .project-share__icons,
    .project-share__icon { transition: none; }
}

.modal-confirm { display: grid; gap: 22px; }
.modal-confirm p { margin: 0; color: rgba(255, 255, 255, .72); }
.modal-confirm__actions { display: flex; justify-content: flex-end; gap: 10px; }

@media (hover: none) {
    .message__delete { opacity: .7; pointer-events: auto; }
    .project-share__icons {
        max-width: 110px;
        visibility: visible;
        pointer-events: auto;
        transition: none;
    }
    .project-share__icon {
        opacity: 1;
        transform: none;
        transition-delay: 0s;
    }
}

@media (max-width: 700px) {
    .media-viewer__nav { width: 40px; height: 52px; border-radius: 10px; font-size: 34px; }
    .media-viewer__nav--prev { left: 8px; }
    .media-viewer__nav--next { right: 8px; }
    .media-viewer__image { max-width: calc(100vw - 24px); max-height: calc(100dvh - 86px); }
    .media-viewer__bar { margin-top: 6px; }
    .media-viewer__original { padding-inline: 9px; }
}

/* Пока окно открыто, страница под ним не прокручивается. */
body.is-modal-open { overflow: hidden; }

/* =============================================================================
   УЗКОЕ ОКНО: ШАПКА ЧАТА
   В шапке семь кнопок, и на узком экране названию не оставалось места — оно
   обрезалось на «Анони…». Уменьшаем кнопки и прячем те, без которых можно:
   таймер дублируется полосой времени жизни под шапкой, а «на главную» и звук
   доступны иначе. Текст при этом не мельчает — уменьшать его дальше некуда.
   ============================================================================= */

@media (max-width: 760px) {
    .chat__header { gap: 6px; padding: 9px 10px; }
    .chat__actions { gap: 4px; }

    .icon-btn { width: 32px; height: 32px; min-width: 32px; }
    .icon-btn svg { width: 16px; height: 16px; }

    .chat__avatar { width: 32px; height: 32px; border-radius: 9px; }
    .chat__avatar svg { width: 18px; height: 18px; }

    /* Название занимает всё свободное место и обрезается только в крайнем случае. */
    .chat__title { flex: 1 1 auto; min-width: 0; gap: 9px; }
    .chat__heading { min-width: 0; }
    .chat__name { font-size: 14px; }
}

@media (max-width: 600px) {
    /* Таймер уезжает: то же время видно по полосе под шапкой. */
    .chat__timer { display: none; }
    .icon-btn--home { display: none; }
}

@media (max-width: 460px) {
    /* Звук остаётся включённым, кнопка просто уезжает: на таком экране важнее
       название комнаты и кнопка удаления. */
    .icon-btn--sound { display: none; }
    .chat__sub { font-size: 10px; }
}

/* =============================================================================
   СТРАНИЦА-ДОКУМЕНТ (правила)
   Отдельный адрес, поэтому оформление своё: спокойный столбец текста без
   снимка и анимаций. Читать правила должно быть легко.
   ============================================================================= */

.doc-page {
    background: #0b1020;
    min-height: 100dvh;
}

.doc-page .shell {
    display: block;
    padding: clamp(22px, 4vw, 46px) 0 60px;
}

.doc {
    width: min(760px, 100%);
    margin: 0 auto;
}

.doc__back {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 22px;
    color: var(--muted, rgba(255, 255, 255, .72));
    font-size: calc(13px * var(--ui));
    text-decoration: none;
}

.doc__back svg { width: 15px; height: 15px; }
.doc__back:hover { color: var(--text, #fff); }

.doc__head { margin-bottom: 30px; }

.doc__head h1 {
    margin: 6px 0 12px;
    font-size: calc(30px * var(--ui));
    line-height: 1.15;
    color: var(--text, #fff);
}

.doc__lead {
    margin: 0;
    max-width: 62ch;
    color: var(--muted, rgba(255, 255, 255, .82));
    font-size: calc(16px * var(--ui));
    line-height: 1.6;
}

.doc__meta {
    margin: 14px 0 0;
    font-size: calc(12px * var(--ui));
    color: var(--subtle, rgba(255, 255, 255, .5));
}

.doc__section { margin-bottom: 26px; }

.doc__section h2 {
    display: flex;
    align-items: center;
    gap: 11px;
    margin: 0 0 12px;
    font-size: calc(18px * var(--ui));
    color: var(--text, #fff);
}

/* Номер раздела в круге: нумерация помогает ссылаться на пункт в разговоре. */
.doc__num {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-2, rgba(255, 255, 255, .1));
    color: var(--text, #fff);
    font-size: 13px;
    font-weight: 700;
}

.doc__section ul {
    margin: 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--line-soft, rgba(255, 255, 255, .07));
}

.doc__section li {
    padding: 12px 0 12px 15px;
    border-bottom: 1px solid var(--line-soft, rgba(255, 255, 255, .07));
    position: relative;
    color: var(--muted, rgba(255, 255, 255, .8));
    font-size: calc(15px * var(--ui));
    line-height: 1.6;
}

.doc__section li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 21px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent, #ff9636);
    opacity: .7;
}

.doc__foot {
    margin-top: 34px;
    padding-top: 20px;
    border-top: 1px solid var(--line-soft, rgba(255, 255, 255, .07));
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.doc__foot p {
    margin: 0;
    font-size: calc(12px * var(--ui));
    color: var(--subtle, rgba(255, 255, 255, .5));
}

html[data-theme="light"] .doc-page { background: #0f5f68; }

/* ------------------------------------------------ форма на странице-документе */

.doc--form { width: min(620px, 100%); }

.doc__notice {
    margin: 0 0 18px;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid var(--line-soft, rgba(255, 255, 255, .1));
    font-size: calc(14px * var(--ui));
}

.doc__notice--ok { border-color: rgba(46, 230, 166, .35); color: #9df3d3; }
.doc__notice--error { border-color: rgba(255, 122, 122, .3); color: #ffc9c9; }

.doc__form { display: grid; gap: 14px; }

.doc__field { display: grid; gap: 6px; }

.doc__field > span {
    font-size: calc(12px * var(--ui));
    letter-spacing: .04em;
    color: var(--subtle, rgba(255, 255, 255, .6));
}

.doc__field i { font-style: normal; opacity: .7; }

.doc__field input,
.doc__field textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--line, rgba(255, 255, 255, .12));
    border-radius: 10px;
    background: rgba(255, 255, 255, .04);
    color: var(--text, #fff);
    font: inherit;
    font-size: calc(15px * var(--ui));
    resize: vertical;
}

.doc__field input:focus,
.doc__field textarea:focus {
    outline: none;
    border-color: var(--accent, #ff9636);
}

/* Ловушка для роботов: убираем из потока, но не через display:none — часть
   роботов такие поля пропускает. */
.doc__trap {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.doc__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    margin-top: 4px;
}

.doc__hint {
    font-size: calc(12px * var(--ui));
    color: var(--subtle, rgba(255, 255, 255, .5));
}

/* Обратная связь остаётся частью проекта: тот же маяк, спокойная тёмная
   карточка и контрастная кнопка вместо отдельного бирюзового экрана. */
.contact-page {
    min-height: 100dvh;
    background:
        linear-gradient(110deg, rgba(2, 6, 17, .9) 0%, rgba(2, 6, 17, .74) 52%, rgba(2, 6, 17, .42) 100%),
        url("../img/start-hero.jpg") center / cover no-repeat fixed;
}

html[data-theme="light"] body.anon-chat-page.contact-page {
    background:
        linear-gradient(110deg, rgba(9, 21, 27, .84) 0%, rgba(9, 21, 27, .65) 52%, rgba(9, 21, 27, .3) 100%),
        url("../img/start-hero-light.jpg") center / cover no-repeat fixed;
}

.contact-page .shell {
    min-height: 100dvh;
    display: grid;
    align-items: center;
    padding: clamp(22px, 4vw, 46px) 0;
}

.contact-page .doc--form {
    width: min(700px, 100%);
    padding: clamp(24px, 4vw, 42px);
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 18px;
    background: linear-gradient(145deg, rgba(14, 25, 34, .9), rgba(11, 18, 28, .86));
    box-shadow: 0 26px 70px rgba(0, 0, 0, .38);
    backdrop-filter: blur(8px);
}

.contact-page .doc__head { margin-bottom: 24px; }
.contact-page .doc__head h1 { color: #fff; }
.contact-page .doc__lead { color: rgba(255, 255, 255, .82); }
.contact-page .doc__field > span,
.contact-page .doc__hint { color: rgba(255, 255, 255, .64); }
.contact-page .doc__field input,
.contact-page .doc__field textarea {
    border-color: rgba(255, 255, 255, .2);
    background: rgba(2, 6, 17, .48);
    color: #fff;
}

.contact-page .doc__field textarea {
    height: 150px;
    min-height: 150px;
    max-height: 340px;
    line-height: 1.55;
    resize: vertical;
}

.contact-page .doc__actions .button--primary {
    border: 0;
    background: linear-gradient(100deg, #ff8a1f, #ffc067);
    color: #281400;
    box-shadow: 0 12px 30px rgba(255, 123, 0, .24);
}

.contact-page .doc__actions .button--primary:hover {
    background: linear-gradient(100deg, #ff9b3d, #ffd08a);
    color: #201000;
    box-shadow: 0 14px 34px rgba(255, 123, 0, .32);
}

@media (max-width: 760px) {
    .contact-page .shell { width: calc(100% - 24px); }
    .contact-page .doc--form { padding: 22px 18px; }
    .contact-page .doc__head h1 { font-size: calc(26px * var(--ui)); }
}

/* Подсказка в панели: короткая инструкция под формой. */
.admin-hint {
    margin: 10px 0 0;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--subtle, rgba(255, 255, 255, .6));
}

.admin-hint b { color: var(--text, #fff); font-weight: 600; }

/* Две кнопки в ряд под формой в панели. */
.admin-form__row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Строка состояния почты: коротко о том, что настроено на самом деле. */
.admin-hint--state {
    margin: 0 0 14px;
    padding: 9px 12px;
    border-radius: 9px;
    background: rgba(255, 255, 255, .04);
}

/* Свёрнутый блок в панели: редкие настройки не занимают место, пока не нужны. */
.admin-more {
    border: 1px solid var(--line-soft, rgba(255, 255, 255, .08));
    border-radius: 10px;
    padding: 0 12px;
}

.admin-more > summary {
    padding: 11px 0;
    cursor: pointer;
    font-size: 13px;
    color: var(--muted, rgba(255, 255, 255, .75));
    list-style: none;
}

.admin-more > summary::-webkit-details-marker { display: none; }
.admin-more > summary::before { content: "+ "; color: var(--accent, #ff9636); }
.admin-more[open] > summary::before { content: "− "; }
.admin-more[open] { padding-bottom: 12px; }
.admin-more > label { margin-top: 10px; }

/* Многострочное поле в панели: тот же вид, что у остальных полей формы. */
.admin-form textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--line, rgba(255, 255, 255, .12));
    border-radius: 10px;
    background: rgba(255, 255, 255, .04);
    color: var(--text, #fff);
    font: inherit;
    font-size: 13.5px;
    line-height: 1.5;
    resize: vertical;
}

.admin-form textarea:focus {
    outline: none;
    border-color: var(--accent, #ff9636);
}

/* Закрытый архив уменьшенных копий для модерации изображений. */
.moderation-panel { padding: 22px; }

.moderation-panel__header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 14px;
}

.moderation-panel__header h2 { margin: 2px 0 5px; font-size: 22px; }
.moderation-panel__header p:last-child { margin: 0; color: var(--muted); font-size: 13px; }

.moderation-panel__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    color: var(--subtle);
    font-family: var(--mono);
    font-size: 12px;
    white-space: nowrap;
}

.moderation-panel__actions form,
.moderation-card form { margin: 0; }
.moderation-panel__notice { margin-bottom: 18px; }
.moderation-panel__empty { min-height: 320px; }

.moderation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.moderation-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(12, 16, 30, .64);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025);
}

.moderation-card__image {
    display: grid;
    place-items: center;
    height: 220px;
    padding: 10px;
    background:
        linear-gradient(45deg, rgba(255,255,255,.025) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.025) 75%),
        linear-gradient(45deg, rgba(255,255,255,.025) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.025) 75%),
        #090d17;
    background-position: 0 0, 10px 10px;
    background-size: 20px 20px;
}

.moderation-card__image img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 7px;
}

.moderation-card__body { display: grid; gap: 12px; padding: 13px; }
.moderation-card__title { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.moderation-card__title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.moderation-card__title time { flex: 0 0 auto; color: var(--subtle); font-size: 11px; }

.moderation-card dl { display: grid; gap: 5px; margin: 0; font-size: 11.5px; }
.moderation-card dl > div { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 8px; }
.moderation-card dt { color: var(--subtle); }
.moderation-card dd { margin: 0; overflow: hidden; color: var(--muted); font-family: var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.moderation-card .button { width: 100%; min-height: 36px; }

@media (max-width: 720px) {
    .moderation-panel { padding: 14px; }
    .moderation-panel__header { align-items: stretch; flex-direction: column; }
    .moderation-panel__actions { align-items: stretch; flex-direction: column; }
    .moderation-panel__actions .button { width: 100%; }
    .moderation-grid { grid-template-columns: 1fr; }
    .moderation-card__image { height: min(68vw, 320px); }
}

.admin-badge {
    display: inline-flex;
    margin-inline-start: 6px;
    padding: 2px 6px;
    border: 1px solid currentColor;
    border-radius: 6px;
    color: var(--accent, #b75b20);
    font-size: 10px;
    line-height: 1.4;
    font-weight: 600;
}
