/*
 * Стили сайта. Направление «Блокнот» — см. «Claude Design/design_handoff_procrastinator/README.md».
 * Все цвета — через переменные; тёмная тема следует настройке устройства. Класс .theme-dark / .theme-light
 * на <html> зарезервирован под выбор вошедшего участника (хранится в его настройках).
 * В шаблонах нет атрибутов style: политика содержимого сайта их запрещает.
 */

/* ---------- Шрифты ---------- */

@font-face {
    font-family: "Literata";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/literata-cyrillic.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: "Literata";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/literata-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Literata";
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/literata-italic-cyrillic.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: "Literata";
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/literata-italic-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "PT Sans";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/ptsans-400-cyrillic.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: "PT Sans";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/ptsans-400-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "PT Sans";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/ptsans-700-cyrillic.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: "PT Sans";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/ptsans-700-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Переменные ---------- */

:root {
    color-scheme: light dark;

    --bg: #F6F1E8;
    --surface: #FFFBF4;
    --surface-2: #EDE5D8;
    --line: #E3D9CC;
    --line-strong: #CDBFAE;
    --ink: #2A2521;
    --ink-2: #4A433D;
    --muted: #6F655C;
    --accent: #C9432F;
    --accent-hover: #B03A28;
    --accent-active: #962F20;
    --accent-text: #B03A28;
    --accent-soft: #FBE9E5;
    --brand: #DC4B37;
    --ok: #2E7D4F;
    --ok-soft: #DCEEE2;
    --warn: #8C6A1E;
    --warn-soft: #F3E9C9;
    --disabled-bg: #E3D9CC;
    --disabled-text: #8C8077;
    --focus: var(--ink);
    --footer-bg: #2A2521;
    --footer-text: #CFC5B8;
    --invert-bg: var(--ink);
    --invert-text: var(--bg);
    --shadow: 0 8px 24px rgba(42, 37, 33, .14);

    --serif: "Literata", Georgia, serif;
    --sans: "PT Sans", Arial, sans-serif;
    --gutter: 20px;
}

@media (prefers-color-scheme: dark) {
    :root:not(.theme-light) {
        --bg: #1E1B18;
        --surface: #28241F;
        --surface-2: #332E28;
        --line: #3A342E;
        --line-strong: #564D44;
        --ink: #EFE8DC;
        --ink-2: #CFC5B8;
        --muted: #A3978A;
        --accent: #D9553F;
        --accent-hover: #E8604C;
        --accent-active: #C9432F;
        --accent-text: #F0836E;
        --accent-soft: #3D2823;
        --ok: #6FBE8E;
        --ok-soft: #223A2C;
        --warn: #D4AC4E;
        --warn-soft: #3A3220;
        --disabled-bg: #3A342E;
        --disabled-text: #7A6F66;
        --footer-bg: #14120F;
        --invert-bg: #EFE8DC;
        --invert-text: #2A2521;
    }
}

:root.theme-dark {
    --bg: #1E1B18;
    --surface: #28241F;
    --surface-2: #332E28;
    --line: #3A342E;
    --line-strong: #564D44;
    --ink: #EFE8DC;
    --ink-2: #CFC5B8;
    --muted: #A3978A;
    --accent: #D9553F;
    --accent-hover: #E8604C;
    --accent-active: #C9432F;
    --accent-text: #F0836E;
    --accent-soft: #3D2823;
    --ok: #6FBE8E;
    --ok-soft: #223A2C;
    --warn: #D4AC4E;
    --warn-soft: #3A3220;
    --disabled-bg: #3A342E;
    --disabled-text: #7A6F66;
    --footer-bg: #14120F;
    --invert-bg: #EFE8DC;
    --invert-text: #2A2521;
}

@media (max-width: 359px) {
    :root { --gutter: 16px; }
}

@media (min-width: 768px) {
    :root { --gutter: 32px; }
}

@media (min-width: 1024px) {
    :root { --gutter: 48px; }
}

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

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

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

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--ink);
    font: 400 18px/1.6 var(--serif);
    overflow-wrap: break-word;
}

@media (min-width: 1024px) {
    body { font-size: 19px; }
}

a {
    color: var(--accent-text);
    text-underline-offset: 3px;
}

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

a:focus-visible {
    outline-offset: 1px;
}

h1, h2, h3, h4 {
    font-family: var(--serif);
    font-weight: 600;
    text-wrap: pretty;
}

h1 {
    margin: 0 0 8px;
    font-size: 28px;
    line-height: 1.15;
    letter-spacing: -.01em;
}

h2 {
    margin: 40px 0 16px;
    font-size: 22px;
    line-height: 1.25;
}

h3 {
    margin: 28px 0 10px;
    font-size: 19px;
    line-height: 1.3;
}

p {
    margin: 0 0 16px;
}

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

@media (min-width: 1024px) {
    h1 { font-size: 40px; }
    h2 { font-size: 26px; }
}

.display {
    font-size: 28px;
    line-height: 1.12;
}

@media (min-width: 1024px) {
    .display { font-size: 46px; }
}

.lead {
    margin: 0 0 24px;
    font-size: 18px;
    line-height: 1.5;
    color: var(--ink-2);
}

@media (min-width: 1024px) {
    .lead { font-size: 21px; }
}

.ui,
.meta,
.caption {
    font-family: var(--sans);
}

.meta {
    margin: 0 0 8px;
    font-size: 14px;
    line-height: 1.4;
    color: var(--muted);
}

.caption {
    margin: 0 0 8px;
    font-size: 13px;
    line-height: 1.3;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
}

.caption-accent {
    color: var(--accent-text);
}

/* Поле-ловушка для программ-рассыльщиков: людям не показывается. */
.form-trap {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.action-quiet {
    font-weight: 400;
    color: var(--muted);
}

.report-reason {
    margin: 0 0 8px;
    padding: 10px 14px;
    border-left: 3px solid var(--accent);
    background: var(--accent-soft);
    overflow-wrap: anywhere;
}

.report-subject {
    margin: 0 0 20px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* ---------- Каркас страницы ---------- */

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

.site-main {
    flex: 1;
    padding-top: 24px;
    padding-bottom: 48px;
}

@media (min-width: 1024px) {
    .site-main {
        padding-top: 40px;
        padding-bottom: 64px;
    }
}

/* Колонка чтения: 60–75 знаков в строке. */
.reading {
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
}

.narrow {
    max-width: 440px;
    margin-left: auto;
    margin-right: auto;
}

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

.site-header {
    border-bottom: 1px solid var(--line);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.3;
}

.site-header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    min-height: 56px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: auto;
    font: 600 18px/1 var(--serif);
    color: var(--ink);
    text-decoration: none;
}

.logo-mark {
    display: block;
    width: 26px;
    height: 26px;
}

.logo-mark path {
    fill: none;
    stroke: currentColor;
    stroke-width: 6;
    stroke-linecap: round;
}

.logo-mark .logo-sun {
    fill: var(--brand);
    stroke: none;
}

/* Меню на телефоне открывается флажком — без скриптов. */
.menu-toggle {
    position: absolute;
    opacity: 0;
    width: 44px;
    height: 44px;
    margin: 0;
}

.menu-button {
    display: inline-flex;
    flex-direction: column;
    gap: 5px;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-right: -12px;
    border-radius: 8px;
    cursor: pointer;
}

.menu-button span {
    width: 20px;
    height: 2px;
    background: var(--ink);
}

.menu-toggle:focus-visible + .menu-button {
    outline: 2px solid var(--focus);
    outline-offset: 3px;
}

.site-menu {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    padding: 8px 0 16px;
    border-top: 1px solid var(--line);
}

.menu-toggle:checked ~ .site-menu {
    display: flex;
}

.site-menu a,
.site-menu .link-button {
    display: flex;
    align-items: center;
    min-height: 44px;
    color: var(--ink);
    text-decoration: none;
}

.site-menu a[aria-current="page"] {
    font-weight: 700;
}

.site-sections,
.site-account {
    display: flex;
    flex-direction: column;
}

.site-account {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.site-account .account-login {
    font-weight: 700;
}

.site-account-name {
    display: flex;
    align-items: center;
    min-height: 44px;
    color: var(--muted);
}

@media (min-width: 768px) {
    .site-header-inner {
        flex-wrap: nowrap;
        gap: 28px;
        min-height: 64px;
    }

    .logo {
        gap: 10px;
        margin-right: 12px;
        font-size: 20px;
    }

    .logo-mark {
        width: 28px;
        height: 28px;
    }

    .menu-toggle,
    .menu-button {
        display: none;
    }

    .site-menu {
        display: flex;
        flex: 1;
        flex-basis: auto;
        flex-direction: row;
        align-items: center;
        padding: 0;
        border-top: 0;
    }

    .site-sections,
    .site-account {
        flex-direction: row;
        align-items: center;
        gap: 22px;
    }

    .site-account {
        margin: 0 0 0 auto;
        padding: 0;
        border: 0;
        gap: 14px;
        font-size: 15px;
        white-space: nowrap;
    }

    .site-menu a,
    .site-menu .link-button,
    .site-account-name {
        min-height: 0;
    }

    .site-sections a {
        padding-bottom: 2px;
        border-bottom: 2px solid transparent;
    }

    .site-sections a[aria-current="page"] {
        font-weight: 400;
        border-bottom-color: var(--accent);
    }

    .site-menu a:hover {
        color: var(--accent-text);
    }
}

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

.site-footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.4;
}

.site-footer-inner {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-top: 28px;
    padding-bottom: 28px;
}

.site-footer nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 20px;
}

.site-footer a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--footer-text);
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

.site-footer :focus-visible {
    outline-color: var(--footer-text);
}

.site-footer-slogan {
    margin: 0;
    max-width: 440px;
    font: italic 400 16px/1.5 var(--serif);
}

@media (min-width: 1024px) {
    .site-footer-inner {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .site-footer-slogan {
        text-align: right;
    }
}

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

.button,
.button-secondary,
.button-danger,
.button-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 20px;
    border: 2px solid transparent;
    border-radius: 8px;
    font: 700 16px/1.2 var(--sans);
    text-decoration: none;
    cursor: pointer;
    transition: background-color .12s, color .12s, border-color .12s;
}

@media (min-width: 1024px) {
    .button,
    .button-secondary,
    .button-danger,
    .button-text {
        min-height: 40px;
        font-size: 15px;
    }
}

.button {
    background: var(--accent);
    color: #fff;
}

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

.button-secondary {
    border-color: var(--ink);
    background: transparent;
    color: var(--ink);
}

.button-secondary:hover { background: var(--surface-2); }

.button-secondary:active {
    background: var(--ink);
    color: var(--bg);
}

.button-danger {
    border-color: var(--accent);
    background: transparent;
    color: var(--accent-text);
}

.button-danger:hover { background: var(--accent-soft); }

.button-danger:active {
    background: var(--accent);
    color: #fff;
}

.button-text {
    padding: 0 8px;
    background: transparent;
    color: var(--accent-text);
}

.button-text:hover { text-decoration: underline; }
.button-text:active { background: var(--surface-2); }

.button:disabled,
.button-secondary:disabled,
.button-danger:disabled {
    border-color: var(--disabled-bg);
    background: var(--disabled-bg);
    color: var(--disabled-text);
    cursor: default;
}

.button-wide {
    width: 100%;
}

/* Кнопка, которая выглядит как ссылка в меню («Выйти»). */
.link-button {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

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

/* Ссылка-действие: «Все статьи →». */
.action-link {
    font: 700 15px/1.3 var(--sans);
    color: var(--accent-text);
    text-decoration: none;
}

.action-link:hover {
    text-decoration: underline;
}

/* ---------- Поля ---------- */

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0 0 18px;
    font-family: var(--sans);
}

.field > label,
.field-label {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
}

.field-hint {
    font-size: 13px;
    line-height: 1.4;
    color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="number"],
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 9px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    font: 400 16px/1.3 var(--sans);
}

@media (min-width: 1024px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="search"],
    input[type="url"],
    input[type="number"],
    select {
        min-height: 40px;
        padding-top: 7px;
        padding-bottom: 7px;
    }
}

textarea {
    min-height: 88px;
    font: 400 17px/1.5 var(--serif);
    resize: vertical;
}

textarea.code {
    font: 400 15px/1.5 ui-monospace, Consolas, monospace;
}

input:focus,
select:focus,
textarea:focus {
    outline: 0;
    border-color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--ink);
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.field-error {
    font: 700 13px/1.4 var(--sans);
    color: var(--accent-text);
}

.field-error::before {
    content: "⚠ ";
}

.check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 44px;
    padding: 10px 0;
    font: 400 16px/1.4 var(--sans);
}

.check input {
    flex: none;
    width: 24px;
    height: 24px;
    margin: 0;
    accent-color: var(--ink);
}

fieldset {
    margin: 0 0 18px;
    padding: 0;
    border: 0;
}

legend {
    padding: 0;
    font: 700 14px/1.3 var(--sans);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin: 24px 0 0;
}

/* ---------- Сообщения ---------- */

.flash,
.form-error {
    margin: 0 0 20px;
    padding: 12px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    font: 400 16px/1.45 var(--sans);
}

.flash-success {
    border-color: var(--ok);
    background: var(--ok-soft);
}

.flash-error,
.form-error {
    border-color: var(--accent);
    background: var(--accent-soft);
}

/* ---------- Вкладки, крошки, страницы списка ---------- */

.tabs {
    display: flex;
    gap: 4px;
    margin: 0 0 20px;
    border-bottom: 1px solid var(--line);
    font: 400 15px/1.3 var(--sans);
    overflow-x: auto;
}

.tabs a {
    flex: none;
    margin-bottom: -1px;
    padding: 10px 12px;
    border-bottom: 3px solid transparent;
    color: var(--ink-2);
    text-decoration: none;
}

.tabs a:hover {
    color: var(--ink);
}

.tabs a[aria-current="page"] {
    border-bottom-color: var(--accent);
    font-weight: 700;
    color: var(--ink);
}

@media (min-width: 1024px) {
    .tabs {
        margin-bottom: 28px;
        font-size: 16px;
    }

    .tabs a { padding: 10px 14px; }
}

.breadcrumbs {
    margin: 0 0 16px;
    font: 400 14px/1.4 var(--sans);
    color: var(--muted);
}

.breadcrumbs a {
    color: var(--muted);
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin: 24px 0 0;
    font: 400 15px/1 var(--sans);
}

.pagination a,
.pagination .current,
.pagination .gap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none;
}

.pagination a:hover {
    background: var(--surface-2);
}

.pagination .current {
    background: var(--ink);
    color: var(--bg);
}

.pagination .gap {
    min-width: 0;
    padding: 0 4px;
    color: var(--muted);
}

.pagination .step {
    padding: 0 8px;
}

.pagination .next {
    margin-left: auto;
}

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

.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

@media (min-width: 640px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (min-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
    }
}

.card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
    overflow: hidden;
}

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

.card-image {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: var(--surface-2);
}

.card-body {
    padding: 16px 18px;
}

@media (min-width: 1024px) {
    .card-body { padding: 18px 20px 20px; }
}

.card-title {
    display: -webkit-box;
    margin: 0 0 8px;
    font: 600 20px/1.3 var(--serif);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
}

.card-text {
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
    color: var(--ink-2);
}

/* Сетка в узкой колонке (главная): не больше двух карточек в ряд. */
@media (min-width: 1024px) {
    .card-grid-2 { grid-template-columns: repeat(2, 1fr); }
}

/* Нумерованный список «Читают чаще всего». */
.ranked {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: ranked;
}

.ranked li {
    display: flex;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    counter-increment: ranked;
}

.ranked li::before {
    content: counter(ranked);
    flex: none;
    width: 22px;
    font: 700 18px/1.4 var(--sans);
    color: var(--accent-text);
}

.ranked a {
    font-weight: 600;
    line-height: 1.35;
    color: var(--ink);
    text-decoration: none;
}

.ranked a:hover {
    text-decoration: underline;
}

.section-head {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    align-items: baseline;
    justify-content: space-between;
    margin: 40px 0 16px;
}

.section-head h2 {
    margin: 0;
}

/* Пустое состояние. */
.empty {
    max-width: 420px;
    margin: 24px auto;
    padding: 22px 18px;
    border: 1px dashed var(--line-strong);
    border-radius: 12px;
    background: var(--surface);
    text-align: center;
}

.empty .logo-mark {
    width: 40px;
    height: 40px;
    margin: 0 auto 12px;
}

.empty-title {
    margin: 0 0 6px;
    font: 600 18px/1.3 var(--serif);
}

.empty-text {
    margin: 0 0 14px;
    font: 400 14px/1.45 var(--sans);
    color: var(--muted);
}

.empty-text:last-child {
    margin-bottom: 0;
}

/* Инвертированный блок-призыв. */
.cta {
    margin: 40px 0;
    padding: 24px;
    border-radius: 12px;
    background: var(--invert-bg);
    color: var(--invert-text);
}

.cta h2 {
    margin: 0 0 8px;
}

.cta p {
    margin: 0 0 16px;
}

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

.hero {
    max-width: 760px;
    padding: 8px 0 8px;
}

.hero .lead {
    margin-bottom: 0;
}

.home-columns {
    display: grid;
    gap: 0 72px;
}

@media (min-width: 1024px) {
    .home-columns {
        grid-template-columns: minmax(0, 1fr) 360px;
    }
}

/* ---------- Статья и текстовая страница ---------- */

.article-head {
    margin-bottom: 24px;
}

.article-head .meta {
    margin: 12px 0 16px;
}

.article-cover {
    display: block;
    width: 100%;
    margin: 0 0 24px;
    border-radius: 12px;
}

.article-body > :first-child {
    margin-top: 0;
}

.article-body p,
.article-body ul,
.article-body ol {
    margin: 0 0 20px;
}

.article-body ul,
.article-body ol {
    padding-left: 24px;
}

.article-body li {
    margin-bottom: 8px;
}

.article-body li::marker {
    color: var(--accent-text);
}

.article-body blockquote {
    margin: 28px 0;
    padding: 4px 0 4px 18px;
    border-left: 3px solid var(--accent);
    font-size: 20px;
    font-style: italic;
    line-height: 1.45;
    color: var(--ink-2);
}

.article-body blockquote > :last-child {
    margin-bottom: 0;
}

@media (min-width: 1024px) {
    .article-body blockquote {
        padding-left: 24px;
        font-size: 22px;
    }
}

.article-body img {
    display: block;
    margin: 24px auto;
    border-radius: 8px;
}

.article-body iframe {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    margin: 24px 0;
    border: 0;
    border-radius: 12px;
    background: var(--surface-2);
}

.article-body figure {
    margin: 24px 0;
}

.article-body figcaption {
    font: 400 14px/1.4 var(--sans);
    color: var(--muted);
    text-align: center;
}

.article-body hr {
    margin: 32px 0;
    border: 0;
    border-top: 1px solid var(--line);
}

.article-body table {
    display: block;
    max-width: 100%;
    margin: 24px 0;
    border-collapse: collapse;
    font: 400 15px/1.4 var(--sans);
    overflow-x: auto;
}

.article-body th,
.article-body td {
    padding: 8px 12px;
    border: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.article-body th {
    background: var(--surface-2);
}

.article-body pre {
    padding: 14px 16px;
    border-radius: 8px;
    background: var(--surface-2);
    font: 400 15px/1.5 ui-monospace, Consolas, monospace;
    overflow-x: auto;
}

.article-body code {
    font: 400 .88em ui-monospace, Consolas, monospace;
}

/* ---------- Вход, регистрация, служебные формы ---------- */

.auth {
    padding: 8px 0 24px;
}

.auth h1 {
    margin-bottom: 20px;
    font-size: 28px;
}

.auth-note {
    margin: 20px 0 0;
    font: 400 14px/1.45 var(--sans);
    color: var(--muted);
}

/* ---------- Страницы ошибок ---------- */

.error-page {
    max-width: 680px;
    padding: 24px 0;
}

.error-page .lead {
    margin-top: 12px;
}

.error-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    align-items: center;
    margin: 24px 0 0;
}

.error-detail {
    margin: 32px 0 0;
    padding: 16px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    font: 400 13px/1.5 ui-monospace, Consolas, monospace;
    overflow-x: auto;
}

/* ---------- Панель управления ---------- */

.admin {
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.45;
}

.admin h1 {
    font: 700 26px/1.2 var(--sans);
    letter-spacing: 0;
}

.admin h2 {
    font: 700 19px/1.3 var(--sans);
}

.admin-layout {
    display: grid;
    gap: 24px;
}

.admin-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.admin-menu a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 12px;
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none;
}

.admin-menu a:hover {
    background: var(--surface-2);
}

.admin-menu a[aria-current="page"] {
    background: var(--surface-2);
    font-weight: 700;
}

@media (min-width: 1024px) {
    .admin-layout {
        grid-template-columns: 220px minmax(0, 1fr);
        gap: 40px;
        align-items: start;
    }

    .admin-menu {
        flex-direction: column;
        flex-wrap: nowrap;
    }

    .admin-menu a {
        min-height: 40px;
    }
}

.admin-form {
    max-width: 760px;
}

.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 12px 12px 0;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.table th {
    font-size: 13px;
    font-weight: 400;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
}

.table td a {
    font-weight: 700;
    color: var(--ink);
    text-decoration: none;
}

.table td a:hover {
    text-decoration: underline;
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--surface-2);
    font: 400 13px/1.4 var(--sans);
    white-space: nowrap;
}

.tag-ok { background: var(--ok-soft); }
.tag-warn { background: var(--warn-soft); }

.danger-zone {
    max-width: 760px;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}

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

.plain-list li {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

/* ---------- Тест ---------- */

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    align-items: center;
    margin: 24px 0 0;
}

.hero-actions .meta {
    margin: 0;
}

.test-progress {
    position: sticky;
    top: 0;
    z-index: 1;
    margin: 0 0 8px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    font: 700 14px/1.3 var(--sans);
}

.test-question {
    margin: 0;
    padding: 24px 0;
    border-bottom: 1px solid var(--line);
}

.test-question legend {
    display: flex;
    gap: 12px;
    margin: 0 0 14px;
    font: 400 19px/1.45 var(--serif);
}

.test-number {
    flex: none;
    min-width: 24px;
    font: 700 16px/1.7 var(--sans);
    color: var(--accent-text);
}

.test-question.is-missing legend {
    color: var(--accent-text);
}

/* Шкала: на телефоне — список с полными подписями, на компьютере — пять кнопок в ряд. */
.scale {
    display: grid;
    gap: 6px;
}

.scale label {
    display: flex;
    gap: 12px;
    align-items: center;
    min-height: 48px;
    padding: 0 14px;
    border: 2px solid var(--ink);
    border-radius: 8px;
    font: 400 16px/1.3 var(--sans);
    cursor: pointer;
    transition: background-color .12s, color .12s;
}

.scale label:hover {
    background: var(--surface-2);
}

.scale-number {
    font-weight: 700;
}

.scale input:checked + label {
    background: var(--ink);
    color: var(--bg);
}

.scale input:focus-visible + label {
    outline: 2px solid var(--focus);
    outline-offset: 3px;
}

.scale-ends {
    display: none;
}

@media (min-width: 768px) {
    .scale {
        grid-template-columns: repeat(5, 1fr);
    }

    .scale label {
        justify-content: center;
        min-height: 52px;
        padding: 0;
    }

    /* Подпись остаётся для экранных читалок и всплывает подсказкой у выбранного варианта. */
    .scale-text {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .scale-ends {
        display: flex;
        justify-content: space-between;
        margin: 8px 0 0;
        font: 400 13px/1.3 var(--sans);
        color: var(--muted);
    }
}

/* Пошаговый режим (включает test.js): один вопрос на экране, крупно, варианты — во всю ширину с подписями. */
.test-form.is-stepped .test-progress {
    position: static;
    margin: 24px 0 28px;
    padding: 0;
    border: 0;
}

.test-step {
    margin: 0 0 10px;
    font: 700 14px/1.3 var(--sans);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--accent-text);
}

.test-progress progress {
    display: block;
    width: 100%;
    height: 6px;
    border: 0;
    border-radius: 3px;
    background: var(--surface-2);
    color: var(--accent);
    appearance: none;
}

.test-progress progress::-webkit-progress-bar {
    border-radius: 3px;
    background: var(--surface-2);
}

.test-progress progress::-webkit-progress-value {
    border-radius: 3px;
    background: var(--accent);
    transition: width .2s;
}

.test-progress progress::-moz-progress-bar {
    border-radius: 3px;
    background: var(--accent);
}

/* Отступ над вопросом — у полосы прогресса: внутренний отступ fieldset встаёт под legend. */
.test-form.is-stepped .test-question {
    padding: 0;
    border: 0;
}

.test-form.is-stepped .test-question legend {
    display: block;
    margin: 0 0 20px;
    font: 400 28px/1.35 var(--serif);
}

.test-form.is-stepped .test-question legend:focus {
    outline: none;
}

/* Номер виден в строке «Вопрос N из 18»; в заголовке он остаётся для экранных читалок. */
.test-form.is-stepped .test-number {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.test-form.is-stepped .scale {
    grid-template-columns: 1fr;
    gap: 8px;
}

.test-form.is-stepped .scale label {
    justify-content: flex-start;
    gap: 16px;
    min-height: 56px;
    padding: 10px 20px;
    font: 400 19px/1.3 var(--sans);
}

.test-form.is-stepped .scale-number {
    min-width: 1.2em;
}

.test-form.is-stepped .scale-text {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
    white-space: normal;
}

.test-form.is-stepped .scale-ends,
.test-form.is-stepped .test-submit {
    display: none;
}

.test-nav:not([hidden]) {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
    margin: 24px 0 0;
}

.test-nav .button,
.test-nav .button-secondary {
    min-width: 140px;
    min-height: 52px;
    font-size: 17px;
}

.test-nav [hidden] {
    display: none;
}

.test-nav .button[aria-disabled="true"] {
    border-color: var(--disabled-bg);
    background: var(--disabled-bg);
    color: var(--disabled-text);
}

.test-hint {
    flex-basis: 100%;
    margin: 0;
    font: 700 15px/1.4 var(--sans);
    color: var(--accent-text);
    text-align: right;
}

.test-hint:empty {
    display: none;
}

@media (max-width: 520px) {
    .test-form.is-stepped .test-progress {
        margin: 16px 0 18px;
    }

    .test-form.is-stepped .test-question legend {
        margin-bottom: 14px;
        font-size: 21px;
    }

    .test-form.is-stepped .scale {
        gap: 6px;
    }

    .test-form.is-stepped .scale label {
        min-height: 46px;
        padding: 8px 16px;
        font-size: 16px;
    }

    .test-nav:not([hidden]) {
        margin-top: 16px;
    }

    .test-hint {
        text-align: left;
    }

    .test-nav .button,
    .test-nav .button-secondary {
        flex: 1;
        min-width: 0;
    }
}

.result-score {
    margin: 0;
    font: 600 56px/1 var(--serif);
    letter-spacing: -.02em;
}

.result-of {
    margin: 4px 0 20px;
    font: 400 15px/1.3 var(--sans);
    color: var(--muted);
}

@media (min-width: 1024px) {
    .result-score { font-size: 72px; }
}

.level-scale {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin: 20px 0 8px;
    padding: 0;
    list-style: none;
    font: 400 13px/1.3 var(--sans);
    color: var(--muted);
}

.level-scale li {
    padding-top: 10px;
    border-top: 6px solid var(--line-strong);
}

.level-scale b {
    display: block;
    font-size: 15px;
    color: var(--ink);
}

.level-scale .is-current {
    border-top-color: var(--accent);
    color: var(--ink);
}

.share {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Второстепенная кнопка на инвертированном блоке. */
.button-invert {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 20px;
    border: 2px solid var(--invert-text);
    border-radius: 8px;
    font: 700 16px/1.2 var(--sans);
    color: var(--invert-text);
    text-decoration: none;
}

.button-invert:hover {
    background: var(--invert-text);
    color: var(--invert-bg);
}

.cta :focus-visible {
    outline-color: var(--invert-text);
}

/* ---------- Загруженные картинки (панель управления) ---------- */

input[type="file"] {
    max-width: 100%;
    font: 400 15px/1.4 var(--sans);
}

.upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

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

.upload-item img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
}

/* ---------- Форум ---------- */

.section-head-top {
    margin-top: 0;
}

.forum-group h2 {
    margin-bottom: 4px;
}

.forum-row,
.topic-row {
    display: grid;
    gap: 6px 24px;
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
}

.forum-row h3,
.topic-row h2 {
    margin: 0 0 4px;
    font: 600 20px/1.3 var(--serif);
}

.topic-row h2 {
    font-size: 18px;
}

.forum-row h3 a,
.topic-row h2 a,
.discussed a {
    color: var(--ink);
    text-decoration: none;
}

.forum-row h3 a:hover,
.topic-row h2 a:hover,
.discussed a:hover {
    text-decoration: underline;
}

.forum-row p,
.topic-row p {
    margin: 0;
}

.forum-row-main p {
    font-size: 16px;
    line-height: 1.45;
    color: var(--ink-2);
}

.forum-row-count,
.forum-row-last,
.topic-row-count,
.topic-row-last {
    font: 400 14px/1.4 var(--sans);
    color: var(--muted);
}

.forum-row-last a {
    display: block;
    font-weight: 700;
    color: var(--ink);
    text-decoration: none;
}

.forum-row-last span,
.topic-row-last span {
    display: block;
}

.topic-row .meta {
    margin: 0;
}

.topic-row.is-pinned {
    margin: 0 -12px;
    padding: 16px 12px;
    border-radius: 8px;
    background: var(--surface);
}

@media (min-width: 768px) {
    .forum-row {
        grid-template-columns: minmax(0, 1fr) 90px 260px;
        align-items: start;
    }

    .topic-row {
        grid-template-columns: minmax(0, 1fr) 110px 200px;
        align-items: start;
    }
}

.tag-outline {
    display: inline-block;
    padding: 1px 6px;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    font: 400 12px/1.4 var(--sans);
    color: var(--ink-2);
}

.discussed {
    display: grid;
    gap: 0 48px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.discussed li {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.discussed a {
    display: block;
    font-weight: 600;
    line-height: 1.35;
}

.discussed .meta {
    margin: 4px 0 0;
}

@media (min-width: 768px) {
    .discussed { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Сообщение ---------- */

.avatar {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font: 700 12px/1 var(--sans);
    color: #2A2521;
}

@media (min-width: 768px) {
    .avatar {
        width: 36px;
        height: 36px;
        font-size: 13px;
    }
}

.avatar-c0 { background: #E8C9B0; }
.avatar-c1 { background: #C9D5E8; }
.avatar-c2 { background: #CFE0CC; }
.avatar-c3 { background: #E6D6C0; }
.avatar-c4 { background: #D8CFE6; }
.avatar-c5 { background: #E3D9CC; }

.avatar-none {
    border: 2px dashed var(--line-strong);
}

.post {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    padding: 20px 0;
    border-bottom: 1px solid var(--line);
    scroll-margin-top: 16px;
}

.post.is-own,
.post.is-pending {
    margin: 12px 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.post.is-pending {
    border-style: dashed;
    border-color: var(--line-strong);
}

.post-meta {
    margin: 0 0 6px;
    font: 400 14px/1.4 var(--sans);
    color: var(--muted);
}

.post-meta b {
    color: var(--ink);
}

.post-meta b.is-gone {
    color: var(--muted);
}

.post-meta a {
    color: var(--muted);
    text-decoration: none;
}

.post-meta a:hover {
    text-decoration: underline;
}

.pending-note {
    display: flex;
    gap: 6px;
    align-items: center;
    margin: 0 0 10px;
    font: 700 14px/1.4 var(--sans);
    color: var(--warn);
}

.pending-note::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warn);
}

.post-body {
    font-size: 18px;
    line-height: 1.55;
}

.post-body > :first-child { margin-top: 0; }
.post-body > :last-child { margin-bottom: 0; }

.post-body p,
.post-body ul,
.post-body ol {
    margin: 0 0 14px;
}

.post-body ul,
.post-body ol {
    padding-left: 24px;
}

.post-body blockquote {
    margin: 0 0 14px;
    padding: 4px 0 4px 18px;
    border-left: 3px solid var(--accent);
    font-size: 17px;
    line-height: 1.5;
    color: var(--ink-2);
}

.post-body blockquote blockquote {
    border-left-color: var(--line-strong);
    color: var(--muted);
}

.post-body blockquote > cite {
    display: block;
    margin-bottom: 6px;
    font: 700 14px/1.3 var(--sans);
    font-style: normal;
    color: var(--muted);
}

.post-body details {
    margin: 0 0 14px;
    padding: 10px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface-2);
}

.post-body details > summary {
    font: 700 15px/1.4 var(--sans);
    cursor: pointer;
}

.post-body details[open] > summary {
    margin-bottom: 10px;
}

.post-body details > :last-child {
    margin-bottom: 0;
}

.own-diaries {
    margin: 0 0 24px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.own-diaries .caption {
    margin: 0 0 6px;
}

.own-diaries ul {
    margin: 0;
    padding: 0;
    list-style: none;
    font: 700 16px/1.6 var(--sans);
}

.feed-row,
.entry-row {
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
}

.feed-row {
    display: flex;
    gap: 12px;
}

.feed-row-main {
    min-width: 0;
    flex: 1;
}

.feed-row h2,
.entry-row h2 {
    margin: 0 0 6px;
    font-size: 22px;
    line-height: 1.25;
}

.feed-row h2 a,
.entry-row h2 a {
    color: var(--ink);
    text-decoration: none;
}

.feed-row h2 a:hover,
.entry-row h2 a:hover {
    text-decoration: underline;
}

.feed-row p,
.entry-row p {
    margin: 0 0 6px;
    overflow-wrap: anywhere;
}

.entry-row.is-pending {
    opacity: .8;
}

.diary-author {
    display: flex;
    gap: 12px;
    align-items: center;
    margin: 0 0 20px;
}

.diary-author .post-meta {
    margin: 0;
}

.entry-body {
    margin-top: 8px;
}

.entry-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    justify-content: space-between;
    margin: 28px 0;
    padding: 14px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.author-link {
    color: inherit;
    text-decoration: none;
}

.author-link:hover {
    text-decoration: underline;
}

img.avatar {
    object-fit: cover;
}

.avatar-large {
    width: 120px;
    height: 120px;
    font-size: 40px;
}

.profile {
    display: grid;
    gap: 32px;
}

.profile-side h1 {
    margin: 12px 0 4px;
}

.profile-about {
    margin-top: 12px;
}

.profile-main section {
    margin-bottom: 32px;
}

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

.profile-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.profile-list p {
    margin: 4px 0 0;
    color: var(--ink-2);
}

@media (min-width: 1024px) {
    .profile {
        grid-template-columns: 260px minmax(0, 1fr);
        gap: 48px;
    }
}

.settings {
    max-width: 680px;
}

.settings-section {
    margin: 32px 0;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}

.settings-section h2 {
    margin-top: 0;
}

.settings .tabs + .settings-section {
    border-top: 0;
    padding-top: 0;
}

.settings-section form + form {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px dashed var(--line);
}

.settings-avatar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    align-items: flex-start;
    margin-bottom: 24px;
}

.settings-danger {
    border-top-color: var(--accent);
}

.messages {
    display: grid;
    gap: 24px;
}

.conversation-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    overflow: hidden;
}

.conversation-row {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    color: inherit;
    text-decoration: none;
}

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

.conversation-row:hover,
.conversation-row.is-current {
    background: var(--surface-2);
}

.conversation-row-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    font: 400 14px/1.4 var(--sans);
}

.conversation-row-main b,
.conversation-subject,
.conversation-excerpt {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.conversation-subject {
    font-weight: 700;
}

.conversation-excerpt {
    color: var(--muted);
}

.conversation-row.is-unread .conversation-subject::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--accent);
}

.thread-head {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.thread-head h2 {
    margin: 0 0 4px;
}

.thread-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 8px;
}

.bubbles {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px 0;
}

.bubble {
    display: flex;
    gap: 10px;
    max-width: 85%;
}

.bubble-main {
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 12px 12px 12px 4px;
    background: var(--surface);
}

.bubble.is-mine {
    align-self: flex-end;
}

.bubble.is-mine .bubble-main {
    border-color: var(--ink);
    border-radius: 12px 12px 4px 12px;
}

.bubble .post-meta {
    margin-bottom: 4px;
}

.bubble .post-body > :last-child {
    margin-bottom: 0;
}

.bubble-status {
    margin: 6px 0 0;
    text-align: right;
}

.messages-empty {
    padding: 20px 0;
}

@media (min-width: 1024px) {
    .messages {
        grid-template-columns: 360px minmax(0, 1fr);
        gap: 40px;
    }
}

.profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    align-items: center;
}

.inline-form {
    display: inline;
}

.topic-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    align-items: center;
}

.notification-list {
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
}

.notification {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.notification.is-unread {
    padding-left: 14px;
    border-left: 3px solid var(--accent);
    background: var(--surface);
}

.notification a {
    color: var(--ink);
}

.oauth-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 20px;
}

.settings-identities {
    margin: 0 0 24px;
}

.settings-identities h3 {
    margin: 0 0 8px;
    font: 700 16px/1.4 var(--sans);
}

.settings-identities form {
    display: block;
    margin-bottom: 8px;
}

.admin-search,
.admin-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 0 0 20px;
}

.admin-search input[type="search"],
.admin-inline input[type="text"] {
    flex: 1 1 200px;
}

.input-short {
    width: 90px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font: 400 14px/1.4 var(--sans);
}

.admin-table th,
.admin-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.admin-facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 6px 16px;
    margin: 0 0 20px;
    font: 400 15px/1.4 var(--sans);
}

.admin-facts dt {
    color: var(--muted);
}

.admin-facts dd {
    margin: 0;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    align-items: center;
    margin: 0 0 28px;
}

.admin-actions form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
}

.admin-group {
    margin: 0 0 24px;
}

.smart-captcha {
    margin: 0 0 16px;
}

.site-search input[type="search"] {
    width: 100%;
    min-height: 40px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 15px;
}

.search-form {
    display: flex;
    gap: 10px;
    margin: 0 0 20px;
}

.search-form input[type="search"] {
    flex: 1;
    min-height: 52px;
    padding: 8px 20px;
    border-radius: 26px;
    font-size: 18px;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 24px;
}

.chip {
    padding: 6px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 20px;
    font: 400 14px/1.3 var(--sans);
    color: var(--ink-2);
    text-decoration: none;
}

.chip.is-active {
    border-color: var(--ink);
    background: var(--ink);
    color: var(--bg);
}

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

.search-result {
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
}

.search-result h2 {
    margin: 4px 0 6px;
    font-size: 22px;
}

.search-result p {
    margin: 0 0 6px;
}

.search-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--surface-2);
}

@media (min-width: 1024px) {
    .site-search {
        margin: 0 20px 0 auto;
    }

    .site-search input[type="search"] {
        width: 200px;
    }

    .site-account {
        margin-left: 0;
    }
}

.poll {
    margin: 0 0 24px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.poll h2 {
    margin: 4px 0 12px;
    font-size: 22px;
}

.poll-results {
    margin: 0 0 8px;
    padding: 0;
    list-style: none;
}

.poll-results li {
    display: grid;
    gap: 4px;
    margin: 0 0 12px;
}

.poll-results li.is-chosen .poll-option {
    font-weight: 700;
}

.poll-results progress {
    width: 100%;
    height: 10px;
    border: 0;
    border-radius: 5px;
    background: var(--surface-2);
    overflow: hidden;
    appearance: none;
}

.poll-results progress::-webkit-progress-bar {
    background: var(--surface-2);
}

.poll-results progress::-webkit-progress-value {
    background: var(--accent);
}

.poll-results progress::-moz-progress-bar {
    background: var(--accent);
}

.poll-fields {
    margin: 0 0 20px;
    padding: 12px 16px;
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
}

.poll-fields summary {
    font: 700 15px/1.4 var(--sans);
    cursor: pointer;
}

.editor-image {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
}

.editor-image label {
    width: 100%;
}

.post-edited {
    white-space: nowrap;
}

.topic-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    align-items: center;
    margin-top: 28px;
    padding: 14px 16px;
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
}

.topic-tools .caption {
    width: 100%;
    margin: 0;
}

.topic-tools form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
}

.topic-tools label {
    font: 400 14px/1.3 var(--sans);
}

.topic-tools select {
    width: auto;
    max-width: 100%;
}

.post-body img {
    display: block;
    margin: 12px 0;
    border-radius: 8px;
}

.post-body pre {
    padding: 12px 14px;
    border-radius: 8px;
    background: var(--surface-2);
    font: 400 15px/1.5 ui-monospace, Consolas, monospace;
    overflow-x: auto;
}

.post-body code {
    font: 400 .88em ui-monospace, Consolas, monospace;
}

.post-actions,
.queue-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 10px;
}

.reply {
    margin-top: 32px;
}

.reply h2 {
    margin-top: 0;
}

.preview {
    margin: 0 0 20px;
    padding: 16px;
    border: 1px dashed var(--line-strong);
    border-radius: 12px;
    background: var(--surface);
}

.review-note {
    margin: 0 0 4px;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--warn-soft);
    font: 400 14px/1.45 var(--sans);
}

/* ---------- Очередь модерации ---------- */

.queue-item {
    margin: 0 0 16px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.queue-item .post-body {
    font-family: var(--serif);
}

.queue-actions {
    margin-top: 16px;
}

.button-ok {
    background: var(--ok);
}

.button-ok:hover,
.button-ok:active {
    background: var(--ok);
    filter: brightness(.92);
}

@media (max-width: 767px) {
    .queue-actions form,
    .queue-actions button {
        width: 100%;
    }
}

.confirm-inline {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    font: 400 14px/1.3 var(--sans);
}

.confirm-inline input {
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--ink);
}

.post-actions form,
.queue-block {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
}

.queue-block {
    margin-left: auto;
}

.lost-text textarea {
    min-height: 200px;
}

/* ---------- Места под рекламу ---------- */

/* Пустое место ничего не занимает: высоту даёт только показанное объявление. */
.ad {
    margin: 32px 0;
}

.ad[hidden] {
    display: none;
}

/* Боковая колонка — только там, где рядом с колонкой чтения есть место. Колонка чтения при этом
   остаётся по центру: незаполненная реклама не сдвигает текст и не оставляет дыры рядом с ним. */
.ad-rail {
    display: none;
}

@media (min-width: 1280px) {
    .with-rail {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 680px minmax(0, 1fr);
    }

    .with-rail .reading {
        grid-column: 2;
        margin-left: 0;
        margin-right: 0;
    }

    .ad-rail {
        display: block;
        grid-column: 3;
        padding-left: 20px;
        max-width: 320px;
    }

    .ad-side {
        position: sticky;
        top: 24px;
        margin-top: 0;
    }
}

/* ---------- Главная: дневники участников ---------- */

.feed-compact {
    display: grid;
    gap: 0 48px;
}

@media (min-width: 1024px) {
    .feed-compact {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.feed-row h3 {
    margin: 0 0 6px;
    overflow-wrap: anywhere;
    font-size: 19px;
    line-height: 1.3;
}

.feed-row h3 a {
    color: var(--ink);
    text-decoration: none;
}

.feed-row h3 a:hover {
    text-decoration: underline;
}

.feed-compact .feed-row-main > p:last-child {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.home-invite {
    max-width: 680px;
    padding: 20px 24px;
    border: 1px dashed var(--line);
    border-radius: 12px;
}

.home-invite p:last-child {
    margin-bottom: 0;
}
