* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --bg: #ffffff; --text: #222222; --muted: #666666; --link: #0066cc;
    --tag-bg: #f0f0f0; --tag-text: #555555; --border: #e0e0e0;


}
[data-theme="dark"] {
    --bg: #1a1a1a; --text: #e0e0e0; --muted: #999999; --link: #66b3ff;
    --tag-bg: #2a2a2a; --tag-text: #cccccc; --border: #333333;


}
html {
    /* Резервируем место под скроллбар всегда — модалки не будут дёргать layout */
    scrollbar-gutter: stable;
}
html, body {
    background: var(--bg); color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.65; transition: background 0.2s, color 0.2s;
    font-size: 17.5px;
}

@media (min-width: 800px) {
    html, body {
        font-size: 18.5px;
    }
}
.container { max-width: 800px; margin: 0 auto; padding: 4px; padding-bottom: 80px; }
h1, h2, h3 { margin: 1.2em 0 0.5em; line-height: 1.3; }
p { margin: 0.8em 0; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
.cover { width: 100%; max-width: 100%; height: auto; display: block; margin: 1em 0; }
.post-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}
.post-card-link:hover { text-decoration: none; }

.post-card {
    position: relative;
    margin: 0;
    padding: 18px 16px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.post-card-link:last-child .post-card { border-bottom: none; }
.post-card-link:hover .post-card { background: var(--tag-bg); }
.post-card-link:active .post-card { background: var(--border); }

.post-card h2 {
    margin: 0 0 8px;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}
.post-excerpt {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 1em;
    line-height: 1.55;
}

.post-card .post-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.85em;
    margin: 0;
}

.post-meta { color: var(--muted); font-size: 0.9em; margin-bottom: 0.5em; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0.5em 0; }
.tag {
    display: inline-block;
    margin: 0 2px;
    padding: 4px 8px;
    background: transparent;
    border-radius: 6px;
    color: var(--text);
    font-size: inherit;
    text-decoration: none !important;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.content { margin-top: 1.5em; }
.content img { max-width: 100%; height: auto; display: block; margin: 1em 0; }
.content p { margin-bottom: 1.1em; }
.content {
    font-size: 1.02em;
    line-height: 1.75;
}
.content h2 { font-size: 1.5em; margin: 1.4em 0 0.5em; }
.content h3 { font-size: 1.22em; margin: 1.3em 0 0.4em; }
.content ul, .content ol { padding-left: 1.6em; }
.content li { margin-bottom: 0.4em; }

.toolbar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 800px;
    background: var(--bg);
    border-top: 1px solid var(--border);
    z-index: 100;
    /* Тулбар — отдельная view-transition группа, не участвует в общем
       fadeInUp при переходах, иначе «прыгает» на 16px по вертикали. */
    view-transition-name: toolbar;
}

/* Отключаем анимацию появления/исчезновения для группы toolbar */
::view-transition-old(toolbar),
::view-transition-new(toolbar) {
    animation: none;
    mix-blend-mode: normal;
}
.toolbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-logo { width: 28px; height: 28px; color: var(--text); }
.brand-text { font-weight: bold; font-size: 1.1em; color: var(--text); }
.toolbar-nav { display: flex; gap: 16px; }
.toolbar-nav a { color: var(--text); font-weight: 500; padding: 4px 8px; }

/* === Админка === */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.admin-post-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.admin-post-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: border-color 0.2s;
}
.admin-post-item:hover {
    border-color: var(--link);
}
.admin-post-info strong {
    font-size: 1.1em;
    display: block;
    margin-bottom: 4px;
}
.admin-post-meta {
    font-size: 0.85em;
    color: var(--muted);
}
.admin-post-actions {
    display: flex;
    gap: 8px;
}
.btn-sm {
    padding: 6px 12px;
    font-size: 0.9em;
}
.btn-danger {
    color: #dc3545;
    border-color: #dc3545;
    background: transparent;
}
.btn-danger:hover {
    background: #dc3545;
    color: #fff;
}
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--muted);
}

/* === Базовые кнопки (используются везде) === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-weight: 500;
    font-size: 1em;
    font-family: inherit;
    text-decoration: none;
    transition: all 0.2s;
}
.btn:hover {
    background: var(--tag-bg);
    text-decoration: none;
}
.btn-primary {
    background: var(--link);
    color: #fff;
    border-color: var(--link);
}
.btn-primary:hover {
    opacity: 0.9;
    background: var(--link);
}
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* === Новый логотип HIT IN === */
.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}
.logo:hover { text-decoration: none; }
.logo-mark {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}
.logo-mark svg {
    width: 100%;
    height: 100%;
}
.logo-text {
    font-weight: 900;
    font-size: 1.2em;
    letter-spacing: 0.05em;
}

/* === Компактный список постов в админке === */
.post-list {
    display: flex;
    flex-direction: column;
}
.post-item {
    display: flex;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}
.post-item:last-child { border-bottom: none; }

.post-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.post-status.published { background: #22c55e; }
.post-status.draft { background: #9ca3af; }

.post-info {
    flex: 1;
    min-width: 0;
}
.post-title {
    font-size: 1.05em;
    font-weight: 600;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.post-date {
    font-size: 0.85em;
    color: var(--muted);
}

.post-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.icon-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--muted);
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}
.icon-btn:hover {
    color: var(--text);
    border-color: var(--text);
}
.icon-btn.danger:hover {
    background: #dc3545;
    border-color: #dc3545;
    color: #fff;
}
.icon-btn svg {
    width: 16px;
    height: 16px;
}

/* === Тулбар с иконками === */
.toolbar-nav .icon-link,
.toolbar-nav a.icon-link,
.toolbar-nav button.icon-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--muted);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.15s;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
}
.toolbar-nav .icon-link:hover,
.toolbar-nav a.icon-link:hover,
.toolbar-nav button.icon-link:hover {
    background: var(--tag-bg);
    color: var(--text);
    text-decoration: none;
}
.toolbar-nav .icon-link.active {
    color: var(--link);
}
.toolbar-nav .icon-link svg {
    width: 22px;
    height: 22px;
}

/* === Улучшенные обложки === */
.cover {
    width: 100%;
    aspect-ratio: 2 / 1; /* Соотношение сторон 2:1 (как у YouTube/Twitter) */
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 16px;
    background: var(--tag-bg);
    display: block;
}
.post .cover {
    aspect-ratio: 2.5 / 1; /* Чуть шире для страницы самого поста */
    margin-bottom: 24px;
}

/* === Премиальные обложки === */
.cover {
    width: 100%;
    aspect-ratio: 2 / 1;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 16px;
    background: #1a1a1a; /* Тёмный фон на случай долгой загрузки */
    display: block;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.post-card:hover .cover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.post .cover {
    aspect-ratio: 2.5 / 1;
    margin-bottom: 24px;
}

/* === Hero-баннер поста === */
.post-hero {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 1;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 0 32px;
    padding: 24px;
    overflow: hidden;
}

/* Подложка под текст — не затемняет всю обложку */
.post-hero-content {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
}

/* Плашки заголовка и даты — размытые края */
.hero-plate {
    position: relative;
    display: inline-block;
    color: #fff;
    margin: 0;
    z-index: 0;
    isolation: isolate;
}

.hero-plate::before {
    content: '';
    position: absolute;
    inset: -8px -24px;
    background: rgba(15, 15, 15, 0.6);
    border-radius: 24px;
    filter: blur(16px);
    z-index: -1;
    pointer-events: none;
}

h1.hero-plate {
    font-size: 2.1em;
    line-height: 1.2;
    font-weight: 700;
    max-width: 100%;
    word-wrap: break-word;
}

.hero-date {
    font-size: 1em;
    margin-top: 12px;
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    text-align: center;
}

/* Дата + просмотры в одну строку */
.hero-date-line {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}

.hero-date::before {
    inset: -6px -18px;
    filter: blur(12px);
    border-radius: 20px;
}

.hero-modified-old {
    font-size: 0.82em;
    color: rgba(255, 255, 255, 0.85);
}

.hero-views {
    font-size: 0.82em;
    color: rgba(255, 255, 255, 0.85);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Хештеги прижаты к низу обложки */
.hero-tags {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding: 0 16px;
    z-index: 2;
}

/* === Сопутствующие теги в hero страницы тега ===
   Прижаты к низу обложки, как .home-hero-tags на главной. */
.hero-related-tags {
    position: absolute;
    left: 0;
    right: 0;
    bottom: clamp(12px, 3.5vw, 28px);
    display: flex;
    flex-wrap: nowrap;
    gap: clamp(5px, 0.8vw, 6px);
    justify-content: center;
    padding: 0 clamp(8px, 1.5vw, 16px);
    overflow: hidden;
    z-index: 2;
}

.hero-tag {
    display: inline-block;
    padding: 4px 8px;
    background: transparent;
    border-radius: 6px;
    color: var(--text);
    font-size: inherit;
    text-decoration: none !important;
    transition: background-color 0.15s ease, color 0.15s ease;
}

/* Заголовок без обложки (fallback) */
.post-header {
    margin: 24px 0 32px;
    text-align: center;
}
.post-header h1 {
    font-size: 2.3em;
    margin: 0 0 12px;
    line-height: 1.15;
}

/* Мобильная адаптация */
@media (max-width: 640px) {
    .post-hero {
        aspect-ratio: 16 / 9;
        padding: 16px;
        border-radius: 8px;
        margin-bottom: 24px;
    }
    .post-hero-content {
        padding: 16px;
    }
    h1.hero-plate {
        font-size: 1.4em;
    }
    .hero-plate::before {
        inset: -6px -16px;
        filter: blur(12px);
    }
    .hero-date {
        font-size: 0.85em;
        margin-top: 10px;
    }
    .hero-tags {
        bottom: 12px;
    }
    .hero-tag {
        font-size: 0.78em;
        padding: 4px 10px;
    }
    .post-hero-content h1 {
        font-size: 1.6em;
    }
    .post-header h1 {
        font-size: 1.6em;
    }
}

/* === Счётчик просмотров === */
.post-card .post-meta {
    display: flex;
    align-items: center;
    gap: 14px;
}
.post-card .views {
    color: var(--muted);
    font-size: 0.9em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}


/* === Индикатор «обновлено» === */
.post-card .modified,
.post .post-modified {
    color: var(--muted);
    font-size: 0.85em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.post-card .modified svg {
    opacity: 0.7;
}


/* === Hero на главной (обложка последнего поста) === */
.home-hero {
    border-radius: 0;
    margin-bottom: 24px;
}
.home-hero .post-hero-content {
        justify-content: center;
        padding-bottom: 60px; /* Освобождаем место внизу для слогана */
    }

/* Логотип как в тулбаре, но крупнее и вертикально */
.home-logo {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 0;
}
.home-logo .logo-mark {
        width: clamp(80px, 18vw, 140px);
        height: clamp(80px, 18vw, 140px);
        flex-shrink: 0;
    }
.home-logo .logo-mark svg {
    width: 100%;
    height: 100%;
}
.home-logo .logo-text {
        font-weight: 900;
        font-size: clamp(1.8rem, 5vw, 3rem);
        letter-spacing: 0.04em;
    }

.home-tagline {
        position: absolute;
        bottom: 24px;
        left: 0;
        right: 0;
        margin: 0 auto;
        width: max-content;
        max-width: 90%;
        font-size: 1.1em; /* Базовый размер, который будет менять JS */
        padding: 6px 16px;
        text-align: center;
        white-space: nowrap;
    }


/* === Теги-навигация в hero главной === */
.home-hero-tags {
    bottom: clamp(12px, 3.5vw, 28px);
    gap: clamp(5px, 0.8vw, 6px);
    padding: 0 clamp(8px, 1.5vw, 16px);
}
.home-hero-tag {
    text-decoration: none;
    transition: background 0.15s, transform 0.15s;
    cursor: pointer;
    /* Пилюли не мельчают ниже 0.78rem — удобно тапать пальцем */
    font-size: clamp(0.78rem, 1.5vw, 0.85rem);
    padding: clamp(4px, 0.8vw, 5px) clamp(10px, 2vw, 12px);
}
.home-hero-tag:hover {
    background: rgba(15, 15, 15, 0.85);
    text-decoration: none;
    transform: translateY(-1px);
}

/* === Страница тега === */
.tag-header {
    text-align: center;
    padding: 32px 16px 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}
.tag-header h1 {
    margin: 0 0 6px;
    font-size: 1.8em;
    color: var(--link);
}
.tag-header .post-meta {
    color: var(--muted);
    font-size: 0.9em;
}

/* === Адаптивное количество тегов в hero главной === */
/* Мобильный (< 500px): показываем 4 тега */
.home-hero-tags .home-hero-tag:nth-child(n+5) {
    display: none;
}

/* Планшет (500-799px): показываем 6 тегов */
@media (min-width: 500px) {
    .home-hero-tags .home-hero-tag:nth-child(n+5) {
        display: inline-block;
    }
    .home-hero-tags .home-hero-tag:nth-child(n+7) {
        display: none;
    }
}

/* Десктоп (>= 800px): показываем все 8 */
@media (min-width: 800px) {
    .home-hero-tags .home-hero-tag:nth-child(n+7) {
        display: inline-block;
    }
}

/* В одну строку, без переноса */
.home-hero-tags {
    flex-wrap: nowrap;
    overflow: hidden;
}

/* ============================================================
   АНИМАЦИИ И ИНТЕРАКТИВ
   ============================================================ */

/* === Ключевые кадры === */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes growProgress {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

/* === View Transitions (Chrome/Edge 111+, Safari 18+, FF 129+) === */
@view-transition {
    navigation: auto;
}

::view-transition-old(root) {
    animation: 0.3s ease-out both fadeOut;
}

::view-transition-new(root) {
    animation: 0.55s cubic-bezier(0.22, 1, 0.36, 1) both fadeInUp;
}

/* === Hero страницы поста и главной: появление снизу вверх === */
.post-hero,
.post-header,
.tag-header {
    animation: fadeInUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Плашки внутри hero — появляются ступенчато после обложки */
.post-hero-content .hero-plate,
.post-hero-content .home-logo {
    animation: fadeInUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 0.25s;
}
.post-hero-content .hero-date,
.post-hero-content .home-tagline {
        position: absolute;
        bottom: 24px;
        left: 0;
        right: 0;
        margin: 0 auto;
        width: max-content;
        max-width: 90%;
        font-size: 1.1em; /* Базовый размер, который будет менять JS */
        padding: 6px 16px;
        text-align: center;
        white-space: nowrap;
    }
.post-hero-content .hero-modified,
.post-hero-content .hero-views {
    animation-delay: 0.4s;
}
.post-hero-content .hero-tags,
.post-hero-content .home-hero-tags {
    animation: fadeInUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 0.45s;
}

/* === Карточки: каскадное появление === */
.post-list .post-card-link {
    animation: fadeInUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.post-list .post-card-link:nth-child(1)  { animation-delay: 0.20s; }
.post-list .post-card-link:nth-child(2)  { animation-delay: 0.26s; }
.post-list .post-card-link:nth-child(3)  { animation-delay: 0.32s; }
.post-list .post-card-link:nth-child(4)  { animation-delay: 0.38s; }
.post-list .post-card-link:nth-child(5)  { animation-delay: 0.44s; }
.post-list .post-card-link:nth-child(6)  { animation-delay: 0.50s; }
.post-list .post-card-link:nth-child(7)  { animation-delay: 0.56s; }
.post-list .post-card-link:nth-child(8)  { animation-delay: 0.62s; }
.post-list .post-card-link:nth-child(n+9){ animation-delay: 0.65s; }

/* === Контент статьи: мягкое появление === */
.post .content {
    animation: fadeInUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 0.30s;
}

/* === Прогресс-бар чтения (только Chrome/Edge 115+) === */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--link);
    transform-origin: 0 50%;
    z-index: 9999;
    pointer-events: none;
    display: none;
}

@supports (animation-timeline: scroll()) {
    .reading-progress {
        display: block;
        animation: growProgress linear;
        animation-timeline: scroll(root);
    }
}

/* === prefers-reduced-motion: уважаем настройки системы === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation: none !important;
    }
}

/* === Страница 404 === */
.not-found {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 60vh;
    padding: 40px 16px;
    animation: fadeInUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.nf-code {
    font-size: 6em;
    font-weight: 900;
    line-height: 1;
    color: var(--link);
    letter-spacing: -0.04em;
    margin-bottom: 12px;
    opacity: 0.15;
    user-select: none;
}

.not-found h1 {
    font-size: 1.6em;
    margin: 0 0 12px;
    color: var(--text);
    animation: fadeInUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 0.15s;
}

.nf-message {
    color: var(--muted);
    font-size: 1em;
    max-width: 420px;
    margin: 0 0 20px;
    animation: fadeInUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 0.25s;
}

.nf-path {
    display: inline-block;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85em;
    padding: 4px 10px;
    background: var(--tag-bg);
    color: var(--muted);
    border-radius: 6px;
    margin-bottom: 24px;
    word-break: break-all;
    max-width: 100%;
    animation: fadeInUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 0.3s;
}

.nf-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    animation: fadeInUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 0.4s;
}

@media (max-width: 640px) {
    .nf-code {
        font-size: 4.5em;
    }
    .not-found h1 {
        font-size: 1.35em;
    }
    .nf-message {
        font-size: 0.95em;
    }
}

/* === Мобильный hero: от края до края, без отступов сверху и скруглений === */
@media (max-width: 640px) {
    /* Убираем верхний паддинг контейнера — hero идёт от самого верха */
    .container {
        padding-top: 0;
    }
    /* Обложка поста и главной — без скруглений (перебиваем раннее правило) */
    .post-hero,
    .home-hero {
        border-radius: 0;
    }
}

/* === Мобильный: убираем горизонтальные отступы, чтобы hero шёл от края до края === */
@media (max-width: 640px) {
    .container {
        padding-left: 0;
        padding-right: 0;
    }
    /* Возвращаем боковые отступы обычному контенту внутри контейнера */
    .container > .post-list,
    .container > .content,
    .container > .post-header,
    .container > .tag-header,
    .container > .not-found,
    .container > .post {
        padding-left: 16px;
        padding-right: 16px;
    }
    /* Но hero внутри статьи — без отступов */
    .post > .post-hero {
        padding-left: 16px;
        padding-right: 16px;
    }
    .post > .post-hero .post-hero-content {
        padding-left: 0;
        padding-right: 0;
    }
    .post-hero,
    .home-hero {
        width: 100vw;
        margin-left: 0;
        margin-right: 0;
        border-radius: 0;
    }
}

/* === Мобильный hero: полное обнуление отступов, edge-to-edge === */
@media (max-width: 640px) {
    body {
        padding: 0 !important;
        margin: 0 !important;
    }
    .container {
        padding: 0 0 80px 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
    }
    .post-hero,
    .home-hero {
        width: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
        padding: 16px !important;
    }
    /* Возвращаем отступы тексту внутри контейнера */
    .container > .post-list,
    .container > .content,
    .container > .post-header,
    .container > .tag-header,
    .container > .not-found {
        padding-left: 16px;
        padding-right: 16px;
    }
    .post > .content {
        padding-left: 16px;
        padding-right: 16px;
    }
    /* Убираем overflow, если 100vw всё ещё где-то есть */
    html, body {
        overflow-x: hidden;
    }
}

/* === Финальный фикс: hero edge-to-edge, контент с отступами === */
@media (max-width: 640px) {
    /* Обнуляем padding у .post — hero должен идти от края */
    .container > .post,
    .container > article.post {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    /* Hero — от края до края */
    .post > .post-hero,
    .post-hero,
    .home-hero {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        border-radius: 0 !important;
    }
    /* Контент статьи — с боковыми отступами */
    .post > .content {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
    /* Fallback: если нет обложки — заголовок тоже с отступом */
    .post > .post-header {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
}

/* === Страница «О блоге» === */
.about {
    padding: 24px 16px;
}

.about-header {
    text-align: center;
    padding: 24px 0 32px;
    margin-bottom: 32px;
    animation: fadeInUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.about-logo {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}
.about-logo .logo-mark {
    width: 72px;
    height: 72px;
}
.about-logo .logo-mark svg {
    width: 100%;
    height: 100%;
}
.about-logo .logo-text {
    font-weight: 900;
    font-size: 1.6em;
    letter-spacing: 0.06em;
}

.about-header h1 {
    margin: 0 0 6px;
    font-size: 1.8em;
}

.about-tagline {
    color: var(--muted);
    font-size: 1em;
    margin: 0;
}

.about-content {
    animation: fadeInUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 0.15s;
}

.about-tags {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    animation: fadeInUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 0.3s;
}

.about-tags h2 {
    font-size: 1.1em;
    margin: 0 0 12px;
    color: var(--muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.about-tags .tags .tag {
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.about-tags .tags .tag:hover {
    background-color: var(--tag-bg);
    color: var(--text);
    text-decoration: none !important;
}

@media (max-width: 640px) {
    .about-logo .logo-mark {
        width: 56px;
        height: 56px;
    }
    .about-logo .logo-text {
        font-size: 1.35em;
    }
    .about-header h1 {
        font-size: 1.5em;
    }
}

/* === Тулбар: три зоны (лого | центр | навигация) === */
.toolbar-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    padding: 4px;
}
.toolbar-inner > .logo {
    justify-self: start;
}
.toolbar-inner > .toolbar-nav {
    justify-self: end;
}
.toolbar-center {
    justify-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

/* === Кликабельные хештеги === */
.hero-tag {
    text-decoration: none;
    color: rgba(255, 255, 255, 0.95);
    transition: background 0.15s, transform 0.15s;
}
.hero-tag:hover {
    background-color: var(--tag-bg);
    color: var(--text);
    text-decoration: none !important;
}

.tag {
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.tag:hover {
    background: var(--link);
    color: #fff;
    text-decoration: none;
}

/* === Hero на странице тега === */
.tag-hero {
    /* без скруглений, как на странице поста */
    border-radius: 0;
    margin-bottom: 24px;
}
.tag-hero .post-hero-content {
    gap: 10px;
}
.tag-hero h1.hero-plate {
    /* #тег крупнее обычного */
    font-size: 2.2em;
}

/* Мобильный edge-to-edge для страницы тега */
@media (max-width: 640px) {
    .tag-hero {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        border-radius: 0 !important;
    }
    .tag-hero h1.hero-plate {
        font-size: 1.7em;
    }
}

/* Убираем старый .tag-header, если он больше не используется */
.tag-header {
    display: none;
}




/* === Отступы для текста поста на больших экранах (как у карточек на главной) === */
@media (min-width: 800px) {
    .post > .content,
    .post > .post-header {
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* === Иконки-кнопки в тулбаре (как .icon-link) === */
.toolbar-nav button.icon-link {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--muted);
    border-radius: 4px;
    transition: all 0.15s;
}
.toolbar-nav button.icon-link:hover {
    background: var(--tag-bg);
    color: var(--text);
}
.toolbar-nav button.icon-link svg {
    width: 22px;
    height: 22px;
}

/* Компактнее для тулбара */
.toolbar-nav {
    display: flex;
    gap: 4px;
    align-items: center;
}

/* === Бургер-меню === */
.burger-menu {
    position: relative;
}
.burger-menu > summary {
    list-style: none;
    cursor: pointer;
}
.burger-menu > summary::-webkit-details-marker {
    display: none;
}
.burger-menu[open] > summary {
    background: var(--tag-bg);
    color: var(--text);
}

/* Панель меню — появляется над тулбаром */
.burger-panel {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    min-width: 180px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 200;
    animation: burgerIn 0.18s ease-out both;
    transform-origin: bottom right;
}

.burger-panel a {
    display: block;
    padding: 10px 14px;
    color: var(--text);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 500;
    transition: background 0.15s;
}
.burger-panel a:hover {
    background: var(--tag-bg);
    text-decoration: none;
    color: var(--text);
}

@keyframes burgerIn {
    from { opacity: 0; transform: scale(0.92) translateY(4px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Закрытие меню по клику вне — реализуем через JS-однострочник, или через details */
@media (prefers-reduced-motion: reduce) {
    .burger-panel {
        animation: none;
    }
}

/* Бургер-панель — стиль как у других модалок */
.toolbar-nav button.icon-link:hover,
.toolbar-nav a.icon-link:hover {
    background: var(--tag-bg);
    color: var(--text);
}

@media (prefers-reduced-motion: reduce) {
    .burger-panel {
        animation: none;
    }
}


/* === Тёмная тема: тоньше начертание === */
[data-theme="dark"] body,
[data-theme="dark"] .content {
    font-weight: 350;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: 0.005em;
}

/* Fallback для систем без variable-шрифтов */
@supports not (font-variation-settings: normal) {
    [data-theme="dark"] body {
        font-weight: 300;
    }
}

/* ============================================================
   МОДАЛКА НАСТРОЕК
   ============================================================ */

.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 49px; /* высота тулбара */
    z-index: 10000;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: settingsFadeIn 0.2s ease-out both;
}
.settings-modal[hidden] { display: none; }

@keyframes settingsFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.settings-panel {
    background: var(--bg);
    color: var(--text);
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    animation: settingsSlideUp 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes settingsSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}
.settings-header h2 {
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
}

.settings-close {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.settings-close:hover {
    background: var(--tag-bg);
    color: var(--text);
}
.settings-close svg {
    width: 20px;
    height: 20px;
}

.settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
    font-size: 1.02em;
    line-height: 1.75;
}
.settings-body p {
    margin: 0 0 1em;
}
.settings-body p:last-child {
    margin-bottom: 0;
}

.settings-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Кнопки темы */
.settings-theme {
    display: flex;
    gap: 8px;
    justify-content: center;
}
.theme-btn {
    flex: 1;
    background: none;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.theme-btn:hover {
    background: var(--tag-bg);
    color: var(--text);
}
.theme-btn.active {
    background: var(--link);
    color: #fff;
    border-color: var(--link);
    box-shadow: 0 0 12px rgba(102, 179, 255, 0.4);
}
.theme-btn svg {
    width: 20px;
    height: 20px;
}

/* Слайдер размера */
.settings-slider {
    display: flex;
    align-items: center;
    gap: 12px;
}
.slider-icon {
    color: var(--muted);
    font-weight: 700;
    font-size: 0.85em;
    flex-shrink: 0;
}
.slider-icon-lg {
    font-size: 1.1em;
}

#font-size-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
#font-size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--link);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 179, 255, 0.5);
    transition: transform 0.15s;
}
#font-size-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}
#font-size-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--link);
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 179, 255, 0.5);
}

.slider-value {
    color: var(--muted);
    font-size: 0.85em;
    font-variant-numeric: tabular-nums;
    min-width: 44px;
    text-align: right;
}

/* === Порядок постов на главной === */
.settings-order {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.settings-order-label {
    color: var(--muted);
    font-size: 0.85em;
    font-weight: 500;
}
.settings-order-btns {
    display: flex;
    gap: 8px;
}
.order-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.15s;
}
.order-btn:hover {
    background: var(--tag-bg);
    color: var(--text);
}
.order-btn.active {
    background: var(--link);
    color: #fff;
    border-color: var(--link);
    box-shadow: 0 0 12px rgba(102, 179, 255, 0.4);
}
.order-btn svg {
    flex-shrink: 0;
}

/* Мобильная адаптация */
@media (max-width: 640px) {
    .settings-modal {
        padding: 0;
        align-items: stretch;
    }
    .settings-panel {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    .settings-body {
        padding: 20px 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .settings-modal,
    .settings-panel {
        animation: none;
    }
}

/* === Крестик закрытия настроек — красный === */
.settings-close {
    background: #e5484d;
    color: #fff;
}
.settings-close:hover {
    background: #c93a3f;
    color: #fff;
    box-shadow: 0 0 10px rgba(229, 72, 77, 0.5);
}


/* ============================================================
   СТРАНИЦА «СЧЁТЧИК ЛЮБОПЫТНЫХ»
   ============================================================ */
.curious-page {
    display: flex;
    flex-direction: column;
    text-align: center;
    min-height: calc(100vh - 60px); /* 60px — высота тулбара */
    padding: 40px 20px 0;
    animation: fadeInUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.curious-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
}

.curious-title {
    font-size: 1.75em;
    color: var(--text);
    margin: 0;
    font-weight: 500;
    max-width: 520px;
    line-height: 1.35;
    animation: fadeInUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 0.1s;
}

.curious-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 32px 48px;
    background: var(--tag-bg);
    border-radius: 24px;
    animation: fadeInUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 0.2s;
}
.curious-counter svg {
    width: 64px;
    height: 64px;
    color: var(--link);
    flex-shrink: 0;
}
.curious-counter .count {
    font-size: 3.2em;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.curious-bots {
    margin: -16px 0 0;
    font-size: 1em;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    animation: fadeInUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 0.25s;
}

.curious-main .btn-lg {
    margin-top: 8px;
    padding: 16px 40px;
    font-size: 1.15em;
    animation: fadeInUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 0.35s;
}

/* «Закрытая часть сайта» — прижата к низу, почти незаметна */
.curious-admin-link {
    display: block;
    margin-top: auto;
    padding: 14px 20px 24px;
    text-align: center;
    font-size: 0.82em;
    color: var(--muted);
    opacity: 0.45;
    text-decoration: none;
    transition: opacity 0.2s;
    animation: fadeInUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 0.45s;
}
.curious-admin-link:hover {
    opacity: 0.85;
    text-decoration: underline;
    color: var(--muted);
}

@media (max-width: 640px) {
    .curious-page {
        min-height: calc(100vh - 56px);
        padding: 24px 20px 0;
    }
    .curious-main {
        gap: 22px;
    }
    .curious-title {
        font-size: 1.35em;
    }
    .curious-counter {
        padding: 24px 32px;
        gap: 14px;
    }
    .curious-counter svg {
        width: 48px;
        height: 48px;
    }
    .curious-counter .count {
        font-size: 2.4em;
    }
    .curious-main .btn-lg {
        padding: 14px 32px;
        font-size: 1.05em;
    }
    .curious-admin-link {
        padding: 12px 16px 20px;
    }
}

/* ============================================================
   СТРАНИЦА НАСТРОЙКИ AI
   ============================================================ */

.ai-status {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 0.95em;
    font-weight: 500;
    margin-bottom: 8px;
}
.ai-status .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.ai-status-none {
    background: var(--tag-bg);
    color: var(--muted);
}
.ai-status-none .dot { background: var(--muted); }

.ai-status-ok {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
}
.ai-status-ok .dot {
    background: #16a34a;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}
[data-theme="dark"] .ai-status-ok { color: #4ade80; }
[data-theme="dark"] .ai-status-ok .dot { background: #4ade80; }

.ai-status-error {
    background: rgba(229, 72, 77, 0.12);
    color: #dc2626;
}
.ai-status-error .dot {
    background: #dc2626;
    box-shadow: 0 0 8px rgba(229, 72, 77, 0.6);
}
[data-theme="dark"] .ai-status-error { color: #f87171; }
[data-theme="dark"] .ai-status-error .dot { background: #f87171; }

.ai-status-pending {
    background: rgba(234, 179, 8, 0.12);
    color: #ca8a04;
}
.ai-status-pending .dot {
    background: #ca8a04;
    animation: aiPulse 1.5s ease-in-out infinite;
}

.ai-check-time {
    color: var(--muted);
    font-size: 0.85em;
    font-weight: 400;
}

@keyframes aiPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.4; transform: scale(0.7); }
}

/* Форма */
.ai-form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}
.ai-form-row label {
    font-size: 0.9em;
    font-weight: 500;
    color: var(--text);
}
.ai-form-row input[type="text"],
.ai-form-row input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 1em;
    border-radius: 8px;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.ai-form-row input[type="text"]:focus,
.ai-form-row input[type="password"]:focus {
    outline: none;
    border-color: var(--link);
    box-shadow: 0 0 0 3px rgba(102, 179, 255, 0.15);
}
.ai-form-row small {
    color: var(--muted);
    font-size: 0.85em;
}

.ai-form-checkbox {
    margin-top: 8px;
    margin-bottom: 24px;
}
.ai-form-checkbox label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 400;
}
.ai-form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--link);
    cursor: pointer;
}

/* Справка */
.ai-help {
    margin-top: 40px;
    padding: 20px;
    background: var(--tag-bg);
    border-radius: 12px;
    font-size: 0.95em;
}
.ai-help h3 {
    margin: 0 0 12px;
    font-size: 1em;
    font-weight: 600;
}
.ai-help ol {
    margin: 0 0 12px;
    padding-left: 1.4em;
    color: var(--muted);
}
.ai-help li {
    margin-bottom: 6px;
}
.ai-help p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9em;
}

/* === Страница метаданных поста === */
.meta-post-title {
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 4px;
}
.meta-post-slug {
    color: var(--muted);
    font-size: 0.9em;
    font-family: 'Consolas', 'Monaco', monospace;
    margin-bottom: 16px;
}

.ai-form-row textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 1em;
    border-radius: 8px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.ai-form-row textarea:focus {
    outline: none;
    border-color: var(--link);
    box-shadow: 0 0 0 3px rgba(102, 179, 255, 0.15);
}

.meta-lock {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.85em;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
}
.meta-lock input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--link);
    cursor: pointer;
    margin: 0;
}

/* === Блок «Читайте также» === */
.related-posts {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
    animation: fadeInUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.related-title {
    font-size: 1.15em;
    font-weight: 600;
    margin: 0 0 16px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.related-posts .post-card h3 {
    margin: 0 0 8px;
    font-size: 1.05em;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}
.related-posts .post-card:last-child {
    border-bottom: none;
}

@media (max-width: 640px) {
    .related-posts {
        margin-top: 32px;
        padding-top: 24px;
    }
    .related-posts .post-card {
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* === Отступы для заголовка «Читайте также» === */
.related-title {
    padding-left: 16px;
    padding-right: 16px;
}

@media (max-width: 640px) {
    .related-title {
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* === Бейдж AI-статуса в списке постов === */
.ai-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 7px;
    font-size: 0.68em;
    font-weight: 700;
    letter-spacing: 0.05em;
    border-radius: 4px;
    vertical-align: middle;
    text-transform: uppercase;
}
.ai-badge-pending {
    background: rgba(234, 179, 8, 0.18);
    color: #ca8a04;
    animation: aiBadgePulse 1.5s ease-in-out infinite;
}
.ai-badge-done {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}
.ai-badge-failed {
    background: rgba(229, 72, 77, 0.15);
    color: #dc2626;
}
[data-theme="dark"] .ai-badge-pending { color: #eab308; }
[data-theme="dark"] .ai-badge-done { color: #4ade80; }
[data-theme="dark"] .ai-badge-failed { color: #f87171; }

@keyframes aiBadgePulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

/* Компактные кнопки действий в списке — 4 иконки */
.post-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* === Бейдж AI-статуса в списке постов === */
.ai-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 7px;
    font-size: 0.68em;
    font-weight: 700;
    letter-spacing: 0.05em;
    border-radius: 4px;
    vertical-align: middle;
    text-transform: uppercase;
}
.ai-badge-pending {
    background: rgba(234, 179, 8, 0.18);
    color: #ca8a04;
    animation: aiBadgePulse 1.5s ease-in-out infinite;
}
.ai-badge-done {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}
.ai-badge-failed {
    background: rgba(229, 72, 77, 0.15);
    color: #dc2626;
}
[data-theme="dark"] .ai-badge-pending { color: #eab308; }
[data-theme="dark"] .ai-badge-done { color: #4ade80; }
[data-theme="dark"] .ai-badge-failed { color: #f87171; }

@keyframes aiBadgePulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

/* Компактнее кнопки действий, когда их 4 */
.post-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* ============================================================
   ПОИСК
   ============================================================ */
.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 49px;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 60px 16px 16px;
    animation: settingsFadeIn 0.2s ease-out both;
}
.search-modal[hidden] { display: none; }

.search-panel {
    background: var(--bg);
    color: var(--text);
    border-radius: 14px;
    width: 100%;
    max-width: 640px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    animation: settingsSlideUp 0.25s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.search-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
}
.search-header svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}
#search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 1.05em;
    font-family: inherit;
    padding: 4px 0;
}
#search-input::placeholder {
    color: var(--muted);
}
.search-close {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.search-close:hover {
    background: var(--tag-bg);
    color: var(--text);
}
.search-close svg {
    width: 18px;
    height: 18px;
}

.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}
.search-hint {
    text-align: center;
    color: var(--muted);
    font-size: 0.9em;
    padding: 24px 16px;
    margin: 0;
}
.search-empty {
    text-align: center;
    color: var(--muted);
    font-size: 0.95em;
    padding: 32px 16px;
    margin: 0;
}
.search-item {
    display: block;
    padding: 12px 14px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    transition: background 0.12s;
    cursor: pointer;
}
.search-item:hover {
    background: var(--tag-bg);
    text-decoration: none;
}
.search-item-title {
    font-weight: 600;
    font-size: 1em;
    color: var(--text);
    margin-bottom: 4px;
    line-height: 1.3;
}
.search-item-excerpt {
    color: var(--muted);
    font-size: 0.9em;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 640px) {
    .search-modal {
        padding: 12px;
        align-items: flex-start;
    }
    .search-panel {
        max-height: 90vh;
    }
    .search-header {
        padding: 14px 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .search-modal,
    .search-panel {
        animation: none;
    }
}

/* ============================================================
   МЕДИА-БИБЛИОТЕКА
   ============================================================ */
.media-summary {
    color: var(--muted);
    font-size: 0.9em;
    margin: 0 0 20px;
}

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

.media-card {
    display: flex;
    flex-direction: column;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.15s, transform 0.15s;
}
.media-card:hover {
    border-color: var(--link);
    transform: translateY(-2px);
}

.media-thumb {
    display: block;
    aspect-ratio: 16 / 9;
    background: var(--tag-bg);
    overflow: hidden;
}
.media-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}
.media-name {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.75em;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.media-size {
    font-size: 0.78em;
    color: var(--muted);
    flex-shrink: 0;
}

.media-actions {
    display: flex;
    gap: 6px;
    padding: 10px 12px;
}
.media-actions .btn-sm {
    flex: 1;
    padding: 6px 8px;
    font-size: 0.82em;
    text-align: center;
}

.media-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--muted);
    padding: 60px 20px;
    font-size: 1em;
    line-height: 1.5;
}

@media (max-width: 640px) {
    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    .media-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    .media-actions {
        flex-direction: column;
    }
}

/* ============================================================
   FILE PICKER (стилизованный input type=file)
   ============================================================ */
.media-upload-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.file-picker {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    max-width: 100%;
}
.file-picker:hover {
    border-color: var(--link);
    background: var(--tag-bg);
}

.file-picker-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.file-picker-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    font-size: 0.9em;
    color: var(--link);
    flex-shrink: 0;
}
.file-picker-btn svg {
    width: 16px;
    height: 16px;
}

.file-picker-name {
    color: var(--muted);
    font-size: 0.85em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
}
.file-picker-name:empty::before {
    content: attr(data-empty);
    opacity: 0.7;
}
.file-picker-name.has-file {
    color: var(--text);
}

@media (max-width: 640px) {
    .media-upload-form {
        width: 100%;
    }
    .file-picker {
        flex: 1;
        min-width: 0;
    }
    .file-picker-name {
        max-width: 100px;
    }
}

/* ============================================================
   АДМИНКА: отступы на узких экранах
   ============================================================ */
@media (max-width: 640px) {
    /* Формы и поля: отступы по 16px с боков */
    .admin-header {
        padding-left: 16px;
        padding-right: 16px;
        flex-wrap: wrap;
        gap: 12px;
        align-items: flex-start;
    }
    .admin-header h1 {
        font-size: 1.4em;
        margin: 0;
    }

    .meta-post-title,
    .meta-post-slug,
    .ai-status,
    .a-form,
    .ai-help,
    .media-summary {
        padding-left: 16px;
        padding-right: 16px;
    }

    /* Форма: поля растягиваются, отступы на кнопках */
    .a-form {
        padding-top: 8px;
    }
    .a-form .ai-form-row {
        padding-left: 0;
        padding-right: 0;
    }
    .a-btns {
        padding-left: 16px;
        padding-right: 16px;
        flex-wrap: wrap;
    }
    .a-btns .btn {
        flex: 1;
        min-width: 0;
        justify-content: center;
    }

    /* Медиа: заголовок и форма в столбик, отступы по 16px */
    .media-summary {
        margin-bottom: 16px;
    }
    .media-grid {
        padding-left: 16px;
        padding-right: 16px;
    }

    /* AI-страница */
    .ai-help {
        margin-left: 0;
        margin-right: 0;
    }

    /* Общий контейнер админки: с боковыми отступами */
    .container > .admin-header,
    .container > .meta-post-title,
    .container > .ai-status,
    .container > .media-grid {
        box-sizing: border-box;
    }
}

@media (max-width: 400px) {
    /* Совсем узко: форма загрузки в столбик */
    .media-upload-form {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    .file-picker {
        justify-content: center;
    }
    .admin-header h1 {
        font-size: 1.25em;
    }
}

/* === ФИНАЛЬНЫЕ ОТСТУПЫ ДЛЯ МОБИЛЬНОЙ АДМИНКИ === */
@media (max-width: 640px) {
    .container > .admin-header,
    .container > .meta-post-title,
    .container > .meta-post-slug,
    .container > .ai-status,
    .container > .a-form,
    .container > .ai-help,
    .container > .media-summary,
    .container > .media-grid,
    .container > .post-list {
        padding-left: 16px !important;
        padding-right: 16px !important;
        box-sizing: border-box;
        margin-left: 0;
        margin-right: 0;
    }

    /* Формы: textarea/input не выходят за контейнер */
    .a-form input,
    .a-form textarea {
        box-sizing: border-box;
        width: 100%;
    }

    /* Кнопки в форме на узких экранах растягиваются */
    .a-btns {
        padding-left: 16px;
        padding-right: 16px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .a-btns .btn {
        flex: 1;
        min-width: 0;
        text-align: center;
        justify-content: center;
    }

    /* .admin-header уже имеет padding выше, но продублируем */
    .admin-header {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
}

/* === Универсальные отступы для прямых детей .container на мобиле === */
@media (max-width: 640px) {
    .container > *:not(.post-hero):not(.home-hero):not(.tag-hero):not(.post):not(article.post):not(.not-found) {
        padding-left: 16px !important;
        padding-right: 16px !important;
        box-sizing: border-box;
    }
}

/* ============================================================
   НОВЫЕ ТЕКСТОВЫЕ ТЕГИ ПОД ОБЛОЖКОЙ
   ============================================================ */
.post-tags-scroll {
    display: block;
    text-align: center;
    white-space: nowrap;
    overflow-x: auto;
    padding: 0 16px;
    margin-top: 16px;
    margin-bottom: 24px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    /* Плавное затухание только по 10px с краев, чтобы не резать текст */
    mask-image: linear-gradient(to right, transparent 0, black 10px, black calc(100% - 10px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0, black 10px, black calc(100% - 10px), transparent 100%);
}
.post-tags-scroll::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}
.post-tags-scroll .hero-tag {
    display: inline-block;
    margin: 0 2px; /* Уменьшили margin, так как добавили padding */
    padding: 4px 8px; /* Место под будущий фон */
    background: transparent;
    border-radius: 6px; /* Мягкое скругление для фона */
    color: var(--text); /* Цвет как у основного текста */
    font-size: inherit;
    text-decoration: none !important;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.post-tags-scroll .hero-tag:hover {
    background-color: var(--tag-bg); /* Фон как у карточек */
    color: var(--text);
    text-decoration: none !important;
}

.post-tags-scroll .hero-tag,
.post-tags-scroll .hero-tag:hover,
.post-tags-scroll .hero-tag:focus,
.post-tags-scroll .hero-tag:active,
.hero-tag,
.hero-tag:hover,
.hero-tag:focus,
.hero-tag:active,
.tag,
.tag:hover,
.tag:focus,
.tag:active {
    text-decoration: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* ============================================================
   МЕТАДАННЫЕ В ПРАВОМ НИЖНЕМ УГЛУ ОБЛОЖКИ
   ============================================================ */
.hero-bottom-right {
    position: absolute;
    bottom: 16px;
    right: 16px;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9em;
    /* Тень для читаемости на светлых участках картинки */
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}



/* Мягкое размытое пятно позади даты (как у заголовка) */


/* Мягкое размытое пятно позади даты (как у .hero-plate::before) */


.hero-bottom-right .hero-views {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Плашка "обновлено" */
.hero-modified-badge {
        position: relative;
        cursor: pointer;
        background: rgba(15, 15, 15, 0.65);
        padding: 4px 10px;
        border-radius: 6px;
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        outline: none;
        border: 1px solid rgba(255, 255, 255, 0.15);
        color: #fff;
        font-size: 0.85em;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
        transition: background 0.15s;
    }

.hero-modified-badge:hover {
    background: rgba(15, 15, 15, 0.85);
}

/* Тултип с датой обновления */
.hero-tooltip {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        background: var(--bg);
        color: var(--text);
        padding: 8px 12px;
        border-radius: 8px;
        font-size: 0.85em;
        white-space: nowrap;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-4px);
        transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
        border: 1px solid var(--border);
        pointer-events: none;
        text-shadow: none;
        font-weight: 500;
        z-index: 10;
    }

/* Показываем тултип при наведении и при клике (фокусе) */
.hero-modified-badge:hover .hero-tooltip,
.hero-modified-badge:focus .hero-tooltip,
.hero-modified-badge:active .hero-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

@media (max-width: 640px) {
    .hero-bottom-right {
        bottom: 12px;
        right: 12px;
        font-size: 0.85em;
    }
}

/* === Исправление читаемости даты и тултипа === */

/* Даем дате и просмотрам темную размытую подложку (как у заголовка) */


/* Убираем тень у текста внутри тултипа, чтобы он четко читался */
.hero-tooltip {
    text-shadow: none;
}

/* Правый верхний угол для плашки */
.hero-top-right {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 3;
}

/* Выравнивание размера и цвета шрифта у даты и просмотров */
.hero-bottom-right .hero-date-line time,
.hero-bottom-right .hero-views {
    font-size: inherit;
    color: inherit;
    font-weight: inherit;
}

/* Убеждаемся, что иконка глаза не плывет по вертикали */
.hero-bottom-right .hero-views svg {
    display: block;
}

/* === Плашка "обновлено" в правом верхнем углу карточки === */
.post-card-modified {
    position: absolute;
    top: 18px;
    right: 16px;
    color: var(--muted);
    font-size: 0.85em;
    cursor: pointer;
    user-select: none;
    transition: color 0.15s ease;
    z-index: 2;
}

.post-card-modified:hover {
    color: var(--text);
}

.post-card-modified .pc-mod-date {
    display: none;
}

/* При наведении или фокусе (тапе) скрываем текст и показываем дату */
.post-card-modified:hover .pc-mod-text,
.post-card-modified:focus .pc-mod-text {
    display: none;
}

.post-card-modified:hover .pc-mod-date,
.post-card-modified:focus .pc-mod-date {
    display: inline;
}

/* Добавляем отступ заголовку, чтобы он не заезжал под плашку */
.post-card h2 {
    padding-right: 85px;
    margin-top: 0;
}

/* ============================================================
   СТРАНИЦА "О ПРОЕКТЕ"
   ============================================================ */
.about-header { text-align: center; padding: 48px 0 32px; margin-bottom: 40px; }
.about-logo { display: inline-flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 24px; }
.about-logo .logo-mark { width: 72px; height: 72px; }
.about-logo .logo-mark svg { width: 100%; height: 100%; }
.about-logo .logo-text { font-weight: 900; font-size: 1.6em; letter-spacing: 0.06em; }
.about-header h1 { font-size: 2em; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.02em; }
.about-tagline { color: var(--muted); font-size: 1.1em; margin-bottom: 24px; }

.live-stats {
    display: flex; justify-content: center; align-items: center; flex-wrap: wrap;
    gap: 16px; padding: 16px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
    font-size: 0.9em; color: var(--muted);
}
.live-stats strong { color: var(--text); font-weight: 700; }
.live-stats .divider { color: var(--border); }

.tech-specs {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
    background: var(--border); border: 1px solid var(--border);
    border-radius: 8px; overflow: hidden; margin: 2em 0;
}
.spec-item { background: var(--bg); padding: 20px; display: flex; flex-direction: column; gap: 4px; }
.spec-item:nth-child(odd) { border-right: 1px solid var(--border); }
.spec-name { font-family: var(--font-mono); font-size: 0.9em; font-weight: 700; color: var(--link); }
.spec-desc { font-size: 0.85em; color: var(--muted); line-height: 1.5; }

.infographic-flow {
    display: flex; align-items: center; justify-content: space-between;
    margin: 2.5em 0; padding: 24px 16px;
    background: var(--tag-bg); border-radius: 8px; border: 1px solid var(--border);
}
.flow-step { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; flex: 1; }
.flow-icon { width: 32px; height: 32px; color: var(--text); }
.flow-step span { font-size: 0.85em; font-weight: 600; color: var(--text); }
.flow-arrow { color: var(--muted); font-family: monospace; font-size: 1.2em; margin: 0 12px; opacity: 0.5; }

.infographic-metrics {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 24px; margin: 2.5em 0; padding: 24px;
    border: 1px solid var(--border); border-radius: 8px;
}
.metric-col { display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--border); padding-right: 24px; }
.metric-col:last-child { border-right: none; padding-right: 0; }
.metric-label { font-size: 0.85em; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.metric-value { font-size: 1.8em; font-weight: 800; line-height: 1.1; color: var(--text); margin-bottom: 4px; }
.metric-sub { font-size: 0.85em; color: var(--muted); }
.bar-container { width: 100%; height: 6px; background: var(--border); border-radius: 3px; margin-top: 12px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--link); border-radius: 3px; width: 4%; }
.bar-fill-ram { height: 100%; background: var(--link); border-radius: 3px; width: 12%; }

.infographic-roadmap { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 2em 0; }
.roadmap-card { padding: 16px; border: 1px dashed var(--border); border-radius: 8px; }
.roadmap-card h4 { font-size: 0.95em; margin-bottom: 4px; color: var(--text); }
.roadmap-card p { font-size: 0.85em; color: var(--muted); margin-bottom: 0; line-height: 1.5; }

@media (max-width: 640px) {
    .live-stats { flex-direction: column; gap: 8px; }
    .live-stats .divider { display: none; }
    .tech-specs { grid-template-columns: 1fr; }
    .spec-item:nth-child(odd) { border-right: none; border-bottom: 1px solid var(--border); }
    .infographic-flow { flex-direction: column; gap: 16px; padding: 32px 16px; }
    .flow-arrow { transform: rotate(90deg); margin: 4px 0; }
    .infographic-metrics { grid-template-columns: 1fr; gap: 16px; }
    .metric-col { border-right: none; border-bottom: 1px solid var(--border); padding-right: 0; padding-bottom: 16px; }
    .metric-col:last-child { border-bottom: none; padding-bottom: 0; }
    .infographic-roadmap { grid-template-columns: 1fr; }
}

/* === Чистые стили для даты и просмотров на обложке === */
.hero-bottom-right .hero-date-line {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
    isolation: isolate;
}

.hero-bottom-right .hero-date-line::before {
    content: '';
    position: absolute;
    inset: -6px -14px;
    background: rgba(15, 15, 15, 0.6);
    border-radius: 999px;
    filter: blur(12px);
    z-index: -1;
    pointer-events: none;
}

.hero-bottom-right .hero-date-line time,
.hero-bottom-right .hero-views {
    font-size: inherit;
    color: inherit;
    font-weight: inherit;
}

.hero-bottom-right .hero-views svg {
    display: block;
}


/* === Форма входа в SPA-админке (с россыпью тегов) === */
.admin-login-wrapper {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.admin-login {
    position: relative;
    z-index: 2;
    max-width: 400px;
    width: 100%;
    padding: 32px;
    margin: 0 16px;
    text-align: center;
}
.admin-login-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 32px;
    color: var(--text);
}
.admin-login-logo .logo-mark {
    width: 32px;
    height: 32px;
}
.admin-login-logo .logo-mark svg {
    width: 100%;
    height: 100%;
}
.admin-login-logo .logo-text {
    font-weight: 900;
    font-size: 1.3em;
    letter-spacing: 0.05em;
}
.admin-login form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.admin-login input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 1em;
    font-family: inherit;
}
.admin-login input[type="password"]:focus {
    outline: none;
    border-color: var(--link);
    box-shadow: 0 0 0 3px rgba(102, 179, 255, 0.15);
}
.admin-login .btn {
    padding: 12px 20px;
    font-size: 1em;
}
.admin-login .editor-error {
    display: block;
    margin-top: 16px;
    text-align: left;
}
.admin-login-back {
    display: inline-block;
    margin-top: 24px;
    color: var(--muted);
    font-size: 0.95em;
    text-decoration: none;
    transition: color 0.15s;
}
.admin-login-back:hover {
    color: var(--text);
    text-decoration: none;
}

/* Плавающие хештеги вокруг формы */
.float-tag {
    position: absolute;
    z-index: 1;
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 0.9em;
    color: var(--muted);
    padding: 4px 10px;
    border-radius: 6px;
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    opacity: 0.5;
    transition: color 0.2s, background 0.2s, opacity 0.2s, transform 0.2s;
}
.float-tag:hover {
    color: var(--text);
    background: var(--tag-bg);
    opacity: 1;
    text-decoration: none;
}

/* На десктопе с тегами back-ссылка не нужна */
@media (min-width: 769px) {
    .admin-login-wrapper:has(.float-tag) .admin-login-back {
        display: none;
    }
}

/* На мобильных — теги скрываем, back показываем */
@media (max-width: 768px) {
    .float-tag {
        display: none;
    }
}

/* === Аутентификация === */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 80vh; padding: 40px 16px; }
.auth-card { width: 100%; max-width: 380px; text-align: center; }
.auth-logo { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 40px; color: var(--text); }
.auth-logo .logo-mark { width: 40px; height: 40px; }
.auth-logo .logo-text { font-weight: 900; font-size: 1.5em; letter-spacing: 0.05em; }
.auth-card h1 { font-size: 1.6em; font-weight: 700; margin: 0 0 8px; letter-spacing: -0.01em; }
.auth-card .subtitle { color: var(--muted); font-size: 0.95em; margin: 0 0 32px; line-height: 1.5; }
.auth-card .field { text-align: left; margin-bottom: 16px; }
.auth-card .field label { display: block; font-size: 0.85em; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.auth-card input { width: 100%; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; font-size: 1em; font-family: inherit; background: var(--bg); color: var(--text); transition: border-color 0.15s, box-shadow 0.15s; box-sizing: border-box; }
.auth-card input:focus { outline: none; border-color: var(--link); box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1); }
.auth-card .hint { color: var(--muted); font-size: 0.78em; margin-top: 6px; line-height: 1.4; }
.auth-card .btn-submit { width: 100%; padding: 14px; margin-top: 12px; border: none; border-radius: 10px; background: var(--link); color: #fff; font-size: 1em; font-weight: 600; font-family: inherit; cursor: pointer; transition: opacity 0.15s; }
.auth-card .btn-submit:hover { opacity: 0.9; }
.auth-card .switch { margin-top: 24px; color: var(--muted); font-size: 0.9em; }
.auth-card .switch a { color: var(--link); text-decoration: none; font-weight: 500; }
.auth-card .switch a:hover { text-decoration: underline; }
.auth-card .city-note { margin-top: 40px; color: var(--muted); font-size: 0.82em; line-height: 1.6; opacity: 0.7; }

/* === Страница жителя === */
.profile-page { max-width: 800px; margin: 0 auto; padding: 32px 16px; }
.profile-header { display: flex; align-items: flex-start; gap: 20px; padding: 32px 0 24px; border-bottom: 1px solid var(--border); position: relative; }
.profile-avatar { width: 88px; height: 88px; border-radius: 50%; background: linear-gradient(135deg, #1f3a5f, #3a1f5f); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 2.2em; font-weight: 700; flex-shrink: 0; }
.profile-info { flex: 1; min-width: 0; }
.profile-info h1 { margin: 0 0 4px; font-size: 1.7em; letter-spacing: -0.01em; }
.profile-info .since { color: var(--muted); font-size: 0.88em; margin-bottom: 12px; }
.profile-info .since strong { color: var(--text); font-weight: 600; }
.profile-bio { color: var(--text); margin: 24px 0; font-size: 1em; line-height: 1.65; }
.settings-icon { position: absolute; top: 24px; right: 0; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--muted); text-decoration: none; transition: background 0.15s; }
.settings-icon:hover { background: var(--tag-bg); color: var(--text); }
.settings-icon svg { width: 20px; height: 20px; }
.hitiny-block { display: flex; align-items: center; gap: 16px; padding: 20px 24px; margin: 24px 0; background: linear-gradient(135deg, #f0f6ff, #fafafa); border: 1px solid #d0e4ff; border-radius: 16px; }
[data-theme="dark"] .hitiny-block { background: linear-gradient(135deg, #1a2a3a, #1a1a1a); border-color: #2a3a4a; }
.hitiny-icon { width: 48px; height: 48px; border-radius: 50%; background: linear-gradient(135deg, #0066cc, #66b3ff); display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; }
.hitiny-icon svg { width: 24px; height: 24px; }
.hitiny-info { flex: 1; }
.hitiny-label { font-size: 0.82em; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; margin-bottom: 2px; }
.hitiny-value { font-size: 2em; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.hitiny-value .unit { font-size: 0.45em; font-weight: 600; color: var(--muted); margin-left: 6px; }
.hitiny-rank { font-size: 0.82em; color: var(--muted); text-align: right; flex-shrink: 0; }
.hitiny-rank strong { display: block; color: var(--text); font-size: 1.2em; font-weight: 700; }
.profile-stats { display: flex; gap: 32px; padding: 16px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: 32px; }
.profile-stats .stat { display: flex; flex-direction: column; }
.profile-stats .stat .num { font-size: 1.4em; font-weight: 700; line-height: 1.2; }
.profile-stats .stat .label { color: var(--muted); font-size: 0.8em; margin-top: 2px; }
.btn-new-post { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 16px; margin: 32px 0 24px; background: var(--link); color: #fff; border: none; border-radius: 12px; font-size: 1rem; font-weight: 600; text-decoration: none; transition: opacity 0.15s; }
.btn-new-post:hover { opacity: 0.9; text-decoration: none; }
.btn-new-post svg { width: 20px; height: 20px; }
.section-title { font-size: 0.85em; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 16px; }
.profile-post { display: block; padding: 16px 0; border-bottom: 1px solid var(--tag-bg); text-decoration: none; color: inherit; }
.profile-post:hover { background: #fafafa; margin: 0 -16px; padding: 16px; }
.profile-post h3 { font-size: 1.05em; font-weight: 600; margin: 0 0 6px; color: var(--text); }
.profile-post .post-meta { display: flex; gap: 12px; font-size: 0.82em; color: var(--muted); }

/* === Круговой прогресс в about === */
.infographic-metrics {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 24px;
    margin: 2.5em 0;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 12px;
    flex-wrap: wrap;
}

.metric-circle-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    min-width: 120px;
}

.circular-chart {
    width: 120px;
    height: 120px;
    margin: 12px 0;
}

.circle-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 6;
}

.circle-fill {
    fill: none;
    stroke: var(--link);
    stroke-width: 6;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    transition: stroke-dashoffset 0.5s ease;
}

.circle-text {
    font-family: inherit;
    font-size: 22px;
    font-weight: 700;
    fill: var(--text);
    text-anchor: middle;
    dominant-baseline: central;
}

.metric-circle-col .metric-label {
    font-size: 0.85em;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.metric-circle-col .metric-sub {
    font-size: 0.85em;
    color: var(--muted);
}

@media (max-width: 640px) {
    .infographic-metrics {
        flex-direction: column;
        padding: 16px;
    }
    .circular-chart {
        width: 100px;
        height: 100px;
    }
    .circle-text {
        font-size: 18px;
    }
}

/* === Блок обзора сервера === */
.server-overview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 2.5em 0 1em;
    padding: 20px;
    background: var(--tag-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.server-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
}

.server-label {
    font-size: 0.8em;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.server-stat strong {
    font-size: 1.1em;
    color: var(--text);
    font-weight: 700;
}

@media (max-width: 640px) {
    .server-overview {
        grid-template-columns: 1fr;
        padding: 16px;
        gap: 12px;
    }
    .server-stat {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
}

/* Запрещаем перенос "RAM" и делаем шрифт чуть меньше на узких экранах */
.server-stat strong {
    white-space: nowrap;
}

@media (max-width: 900px) {
    .server-stat strong {
        font-size: 1em;
    }
}
