/* Quantis — стили сайта.
   Палитра повторяет классическую тему десктопного клиента: графит + один синий акцент. */

:root {
    --bg: #0f1012;
    --surface: #16171a;
    --surface-2: #1d1f23;
    --border: #26282d;
    --border-strong: #363940;

    --text: #e9e9eb;
    --text-2: #a3a6ad;
    --text-3: #6e727a;

    --accent: #3aa8d8;
    --accent-hover: #5cb9e2;
    --accent-ink: #061820;
    --accent-soft: rgba(58, 168, 216, 0.12);

    --danger: #e5484d;
    --success: #46a758;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;

    --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
    --container: 1120px;
}

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

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

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

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

h1, h2, h3 {
    line-height: 1.2;
    letter-spacing: -0.01em;
}

::selection {
    background: var(--accent-soft);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---------- Каркас ---------- */

.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 20px;
}

.container-narrow {
    max-width: 720px;
}

.site-main {
    flex: 1;
    width: 100%;
    padding: 40px 0 64px;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(15, 16, 18, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.site-header .container {
    display: flex;
    align-items: center;
    gap: 32px;
    height: 60px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 17px;
}

.brand img {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    object-fit: cover;
}

.nav {
    display: flex;
    gap: 4px;
    flex: 1;
}

.nav a {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-weight: 500;
    font-size: 14px;
    transition: color 0.15s, background 0.15s;
}

.nav a:hover {
    color: var(--text);
    background: var(--surface-2);
}

.nav a.is-active {
    color: var(--text);
}

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

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s;
}

.user-chip:hover {
    background: var(--surface-2);
}

.site-footer {
    border-top: 1px solid var(--border);
    color: var(--text-3);
    font-size: 14px;
}

.site-footer .container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 24px;
    padding-bottom: 24px;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a:hover {
    color: var(--text);
}

@media (max-width: 720px) {
    .site-header .container {
        gap: 12px;
    }

    .nav {
        overflow-x: auto;
    }

    .nav a {
        padding: 6px 8px;
    }

    .brand span {
        display: none;
    }
}

/* ---------- Типографика ---------- */

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}

.page-title {
    font-size: 30px;
    font-weight: 700;
}

.page-subtitle {
    margin-top: 6px;
    color: var(--text-2);
}

.section-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 16px;
}

.muted {
    color: var(--text-2);
}

.faint {
    color: var(--text-3);
}

.small {
    font-size: 13px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
    color: var(--text-3);
    font-size: 14px;
    font-weight: 500;
}

.back-link:hover {
    color: var(--text);
}

.meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    color: var(--text-3);
    font-size: 13px;
}

.prose {
    color: var(--text-2);
    font-size: 16px;
    line-height: 1.75;
}

.prose p + p {
    margin-top: 1em;
}

.line-clamp-2,
.line-clamp-3 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-2 {
    -webkit-line-clamp: 2;
}

.line-clamp-3 {
    -webkit-line-clamp: 3;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: var(--accent);
    color: var(--accent-ink);
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text);
}

.btn-secondary:hover {
    border-color: var(--text-3);
}

.btn-ghost {
    background: transparent;
    color: var(--text-2);
}

.btn-ghost:hover {
    color: var(--text);
    background: var(--surface-2);
}

.btn-danger {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--danger);
}

.btn-danger:hover {
    border-color: var(--danger);
}

.btn-lg {
    height: 44px;
    padding: 0 20px;
    font-size: 15px;
}

.btn-block {
    width: 100%;
}

/* ---------- Карточки ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.card-pad {
    padding: 24px;
}

.card-link {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: border-color 0.15s;
}

.card-link:hover {
    border-color: var(--border-strong);
}

.card-link:hover .card-title {
    color: var(--accent-hover);
}

.card-media {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}

.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-media .badge {
    position: absolute;
    top: 10px;
    right: 10px;
}

/* Заглушка вместо картинки: инициалы на ровном фоне. */
.placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-3);
    font-size: 28px;
    font-weight: 700;
    text-transform: uppercase;
    user-select: none;
}

.card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 6px;
    padding: 16px 18px 18px;
}

.card-title {
    font-size: 17px;
    font-weight: 700;
    transition: color 0.15s;
}

.card-text {
    color: var(--text-2);
    font-size: 14px;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 12px;
    color: var(--text-3);
    font-size: 13px;
}

.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(15, 16, 18, 0.85);
    border: 1px solid var(--border-strong);
    color: var(--text-2);
    font-size: 12px;
    font-weight: 600;
}

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

.empty-state {
    padding: 56px 24px;
    text-align: center;
    color: var(--text-2);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
}

.empty-state p + p {
    margin-top: 4px;
    color: var(--text-3);
    font-size: 14px;
}

/* ---------- Аватары ---------- */

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    color: var(--text-2);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-xl {
    width: 88px;
    height: 88px;
    font-size: 28px;
}

/* ---------- Формы ---------- */

.form p {
    margin-bottom: 18px;
}

.form label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-2);
    font-size: 13px;
    font-weight: 600;
}

.form input[type="text"],
.form input[type="password"],
.form input[type="email"],
.form input[type="url"],
.form input[type="number"],
.form textarea,
.form select,
.input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    transition: border-color 0.15s;
}

.form textarea {
    height: auto;
    min-height: 120px;
    padding: 10px 12px;
    resize: vertical;
}

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

.form input[type="file"] {
    width: 100%;
    color: var(--text-2);
    font: inherit;
    font-size: 13px;
}

.form input[type="file"]::file-selector-button {
    margin-right: 12px;
    padding: 7px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.form input[type="file"]::file-selector-button:hover {
    border-color: var(--text-3);
}

.form input[type="checkbox"] {
    accent-color: var(--accent);
    margin-right: 6px;
}

.form .helptext,
.form .helptext ul {
    display: block;
    margin-top: 6px;
    color: var(--text-3);
    font-size: 12px;
}

.form .helptext ul {
    padding-left: 18px;
}

.form .errorlist {
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
    color: var(--danger);
    font-size: 13px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* ---------- Страницы входа ---------- */

.auth-page {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-card {
    width: 100%;
    max-width: 380px;
}

.auth-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    text-align: center;
}

.auth-head img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

.auth-head h1 {
    font-size: 22px;
    font-weight: 700;
}

.auth-alt {
    margin-top: 20px;
    text-align: center;
    color: var(--text-3);
    font-size: 14px;
}

.auth-alt a {
    color: var(--accent);
    font-weight: 600;
}

.auth-alt a:hover {
    color: var(--accent-hover);
}

/* ---------- Пагинация ---------- */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 32px;
    color: var(--text-3);
    font-size: 14px;
}

/* ---------- Главная ---------- */

.hero {
    padding: 48px 0 56px;
    max-width: 720px;
}

.hero h1 {
    font-size: clamp(34px, 5vw, 52px);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.hero p {
    margin-top: 18px;
    color: var(--text-2);
    font-size: 18px;
    max-width: 600px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 28px;
}

.source-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.source {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.source-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 14px;
    margin-bottom: 4px;
}

.source-icon svg {
    width: 20px;
    height: 20px;
}

.source h3 {
    font-size: 16px;
    font-weight: 700;
}

.source p {
    color: var(--text-2);
    font-size: 14px;
}

.section {
    margin-top: 64px;
}

.feature-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 28px 32px;
}

.feature h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
}

.feature p {
    color: var(--text-2);
    font-size: 14px;
}

.split {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.split > div {
    max-width: 560px;
}

.split h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

/* ---------- Новости ---------- */

.featured {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    overflow: hidden;
    margin-bottom: 32px;
}

.featured .card-media {
    aspect-ratio: auto;
    min-height: 260px;
    border-bottom: 0;
    border-right: 1px solid var(--border);
}

.featured-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    padding: 32px;
}

.featured-body .card-title {
    font-size: 26px;
}

@media (max-width: 800px) {
    .featured {
        grid-template-columns: 1fr;
    }

    .featured .card-media {
        min-height: 200px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }
}

.article-cover {
    margin: 24px 0 32px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.article-cover img {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
}

/* ---------- Плагин ---------- */

.detail {
    display: grid;
    grid-template-columns: minmax(0, 360px) 1fr;
    gap: 32px;
    align-items: start;
}

.detail .card-media {
    aspect-ratio: 1;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.detail h1 {
    font-size: 32px;
    font-weight: 800;
    margin: 10px 0 14px;
}

.detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 28px;
}

@media (max-width: 720px) {
    .detail {
        grid-template-columns: 1fr;
    }

    .detail .card-media {
        aspect-ratio: 16 / 9;
    }
}

/* ---------- Комната ---------- */

.room-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.room-title {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.room-title img {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--border);
}

.room-title h1 {
    font-size: 24px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-3);
    font-size: 13px;
    white-space: nowrap;
}

.status::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-3);
}

.status.is-online::before {
    background: var(--success);
}

.status.is-offline {
    color: var(--danger);
}

.status.is-offline::before {
    background: var(--danger);
}

.room-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 16px;
    height: min(70vh, 720px);
    min-height: 420px;
}

@media (max-width: 900px) {
    .room-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .chat {
        height: 60vh;
    }
}

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

.chat-log {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 20px;
    overflow-y: auto;
}

.msg {
    padding: 6px 0;
    max-width: 75%;
}

.msg-author {
    display: block;
    margin-bottom: 2px;
    color: var(--text-3);
    font-size: 12px;
    font-weight: 600;
}

.msg-text {
    display: inline-block;
    padding: 8px 12px;
    background: var(--surface-2);
    border-radius: 4px 12px 12px 12px;
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.msg-me {
    align-self: flex-end;
    text-align: right;
}

.msg-me .msg-text {
    text-align: left;
    background: var(--accent-soft);
    border-radius: 12px 4px 12px 12px;
}

.event {
    align-self: center;
    padding: 6px 0;
    color: var(--text-3);
    font-size: 13px;
    text-align: center;
}

.event b {
    color: var(--text-2);
    font-weight: 600;
}

.chat-empty {
    margin: auto;
    color: var(--text-3);
    font-size: 14px;
}

.chat-input {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border);
}

.members {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.members-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
    font-size: 14px;
    font-weight: 700;
}

.members-list {
    flex: 1;
    margin: 0;
    padding: 0 8px 8px;
    list-style: none;
    overflow-y: auto;
}

.members-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.members-list .faint {
    padding: 16px 8px;
    font-size: 13px;
}

/* ---------- Пароль комнаты ---------- */

.lock-card {
    max-width: 380px;
    margin: 40px auto 0;
    text-align: center;
}

.lock-card h1 {
    font-size: 22px;
    font-weight: 700;
    margin-top: 16px;
}

.lock-card .form {
    margin-top: 24px;
    text-align: left;
}

.lock-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--text-2);
}

.lock-icon svg {
    width: 20px;
    height: 20px;
}

/* ---------- Профиль ---------- */

.profile-card {
    max-width: 420px;
    margin: 0 auto;
}

.profile-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    text-align: center;
}

.profile-head h1 {
    font-size: 22px;
    font-weight: 700;
}

.profile-logout {
    margin-top: 16px;
}

.source-yandex { background: #fc3f1d; }
.source-youtube { background: #ff0033; }
.source-soundcloud { background: #ff5500; }

.split .hero-actions {
    margin-top: 0;
}

.page-title + .prose {
    margin-top: 20px;
}

.grid-cards > .empty-state {
    grid-column: 1 / -1;
}

.page-title + .card {
    margin-top: 20px;
}

.page-title + .meta {
    margin-top: 10px;
}

.meta + .prose {
    margin-top: 24px;
}

.chat-input .input {
    flex: 1;
}
