/* ========================================
   Дневничок — Mobile-first CSS
   ======================================== */

:root {
    --bg: #f5f5f5;
    --bg-card: #ffffff;
    --text: #222222;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border: #e0e0e0;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --success: #16a34a;
    --warning: #f59e0b;
    --rating-positive: #16a34a;
    --rating-negative: #dc2626;
    --rating-neutral: #666666;
    --header-bg: #ffffff;
    --footer-bg: #f8f8f8;
    --online: #22c55e;
    --comment-guest-bg: #f9f9f9;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --radius: 8px;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

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

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    overflow-x: hidden;
}

/* Two-column layout */
.content-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}
.content-main {
    flex: 0 0 calc(80% - 12px - 100px);
    min-width: 0;
}
.content-sidebar {
    flex: 0 0 calc(20% - 12px + 100px);
    background: #2a2a2a;
    border-radius: 8px;
    min-height: 400px;
    position: sticky;
    top: 80px;
}
.content-sidebar--post {
    background: #dbeafe;
}
@media (max-width: 768px) {
    .content-sidebar { display: none; }
    .content-layout { display: block; }
    .content-main { flex: none; width: auto; }
}

/* Header */
.site-header {
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}
.logo:hover {
    text-decoration: none;
    color: var(--primary);
}
.site-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}
.site-nav .user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
}
.site-nav .user-link {
    font-weight: 500;
}

/* Header avatar + dropdown */
.header-user {
    position: relative;
}

.header-avatar-wrapper {
    cursor: pointer;
    display: flex;
    align-items: center;
}
.header-avatar-wrapper:hover {
    opacity: 0.85;
}
.header-dropdown hr {
    margin: 0;
    border: none;
    border-top: 1px solid var(--border);
}
.dropdown-item {
    display: block;
    padding: 10px 16px;
    color: var(--text);
    font-size: 0.9rem;
    text-decoration: none;
}
.dropdown-item:hover {
    background: var(--bg);
    text-decoration: none;
}

/* Letter avatars (Google-style) */
.avatar-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    text-transform: uppercase;
    user-select: none;
}
.avatar-letter-lg {
    width: 64px;
    height: 64px;
    font-size: 1.6rem;
}

/* Notification bell */
.notif-wrapper {
    position: relative;
    display: inline-block;
}
.notif-bell {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px 6px;
    line-height: 1;
    position: relative;
    border-radius: var(--radius);
    transition: background 0.15s;
}
.notif-bell:hover {
    background: var(--bg);
}
.notif-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    pointer-events: none;
}
.notif-modal {
    max-width: 580px;
}
.profile-modal {
    max-width: 320px;
}

/* Modal popup shared styles */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
}
.modal-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 380px;
    max-width: 90vw;
    max-height: 80vh;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 1rem;
}
.modal-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-secondary);
    line-height: 1;
}
.modal-close:hover {
    background: var(--bg);
    color: var(--text);
}
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
}
.modal-sep {
    color: var(--text-muted);
}
.modal-toggle-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.modal-toggle-link:hover {
    text-decoration: underline;
}
.logout-item {
    color: var(--text-muted);
    text-decoration: none;
    cursor: pointer;
}
.logout-item:hover {
    color: #dc2626;
    text-decoration: underline;
}
.profile-modal hr {
    margin: 0;
    border: none;
    border-top: 1px solid var(--border);
}
.dropdown-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
}
.dropdown-nickname {
    font-weight: 600;
    font-size: 0.95rem;
}
.dropdown-username {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.dropdown-item {
    display: block;
    padding: 10px 16px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.1s;
}
.dropdown-item:hover {
    background: var(--bg);
}
.avatar-letter-lg {
    width: 48px;
    height: 48px;
    font-size: 1.2rem;
}
.notif-list {
    max-height: 400px;
    overflow-y: auto;
}
.notif-item {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}
.notif-item:hover {
    background: var(--bg);
}
.notif-item:last-child {
    border-bottom: none;
}
.notif-unread {
    background: var(--primary-light);
}
.notif-unread:hover {
    background: #dbeafe;
}
.notif-avatar {
    flex-shrink: 0;
}
.notif-content {
    flex: 1;
    min-width: 0;
}
.notif-text {
    font-size: 0.85rem;
    color: var(--text);
    line-height: 1.4;
}
.notif-link {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
}
.notif-link:hover {
    text-decoration: underline;
}
.notif-userlink {
    font-weight: 600;
}
.notif-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.notif-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.notif-mark-all {
    font-size: 0.85rem;
    cursor: pointer;
}

/* Main */
.site-main {
    min-height: calc(100vh - 120px);
    padding: 20px 0;
    overflow-x: hidden;
}

/* Footer */
.site-footer {
    background: var(--footer-bg);
    border-top: 1px solid var(--border);
    padding: 16px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    font-family: inherit;
}
.btn:hover {
    background: #f0f0f0;
    text-decoration: none;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-hover);
}
.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
}
.btn-sm {
    padding: 4px 10px;
    font-size: 0.85rem;
}
.btn-block {
    width: 100%;
}
.btn-icon {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    color: var(--text-muted);
    border-radius: var(--radius);
}
.btn-icon:hover {
    background: var(--bg);
    color: var(--text);
}
.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: all 0.15s;
    font-family: inherit;
}
.btn-action:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}
.btn-action.active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}
.btn-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn-action .count {
    font-weight: 500;
    color: var(--text);
}
.btn-action-sm {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px 8px;
    border: none;
    border-radius: var(--radius);
    background: none;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: inherit;
}
.btn-action-sm:hover {
    color: var(--text);
    background: var(--bg);
}
.btn-action-sm.active {
    color: var(--primary);
}
.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px 0;
    font-family: inherit;
    text-decoration: none;
}
.btn-link:hover {
    text-decoration: underline;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 0.95rem;
}
.form-group small {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 2px;
}
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    background: var(--bg-card);
    transition: border-color 0.15s;
}
input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.radio-group label {
    font-weight: 400;
    cursor: pointer;
}
.radio-group input {
    margin-right: 6px;
}
.form-errors {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 16px;
}
.form-errors .error {
    color: var(--danger);
    font-size: 0.9rem;
}

/* Auth pages */
.auth-page {
    max-width: 400px;
    margin: 0 auto;
    padding: 40px 16px;
}
.auth-page h1 {
    text-align: center;
    margin-bottom: 24px;
}
.auth-switch {
    text-align: center;
    margin-top: 16px;
    color: var(--text-muted);
}

/* Post card */
.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.post-card .post-header,
.post-full .post-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    position: relative;
}
.post-header .post-author-name {
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
    white-space: nowrap;
}
.post-header .post-author-username {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.post-header .post-rating {
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
}
.post-header .post-rating.positive { color: var(--rating-positive); }
.post-header .post-rating.negative { color: var(--rating-negative); }
.post-header .post-rating.neutral { color: var(--rating-neutral); }
.post-header .post-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    margin-left: auto;
}
.edited-icon {
    font-size: 0.75rem;
    cursor: default;
    opacity: 0.6;
    margin-left: 4px;
}

.post-stat {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Collapsible post content */
.post-content-collapsible {
    overflow: hidden;
    height: 0;
    transition: height 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Post menu */
.post-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    min-width: 200px;
    z-index: 50;
    padding: 4px 0;
}
.post-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 14px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text);
    font-family: inherit;
}
.post-menu button:hover {
    background: var(--bg);
}
.post-menu hr {
    margin: 4px 0;
    border: none;
    border-top: 1px solid var(--border);
}

/* Post body */
.post-body {
    margin-bottom: 12px;
    overflow: hidden;
}
.post-body .post-cover,
.post-full .post-body .post-cover,
.post-cover {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    border-radius: var(--radius);
    overflow: hidden;
    max-width: 100%;
    height: 90px;
    background-size: cover;
    background-position: center;
    text-decoration: none;
    cursor: pointer;
    position: relative;
}

.cover-overlay-text {
    display: block;
    width: 100%;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.post-rating-cover {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.4;
    color: #fff;
    z-index: 5;
}
.post-rating-cover.positive { background: #16a34a; }
.post-rating-cover.negative { background: #dc2626; }
.post-rating-cover.neutral  { background: #6b7280; }

.post-rating-badge {
    margin-left: auto;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}
.post-rating-badge.positive { background: #16a34a; }
.post-rating-badge.negative { background: #dc2626; }
.post-rating-badge.neutral  { background: #6b7280; }

.post-card .post-rating {
    display: none;
}

/* Top comment preview */
.top-comment-preview {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    cursor: pointer;
    overflow: hidden;
    text-decoration: none;
}
.top-comment-preview:hover {
    background: var(--bg-hover);
}
.top-comment-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}
.top-comment-author {
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    flex-shrink: 0;
}
.top-comment-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.top-comment-likes {
    flex-shrink: 0;
    font-weight: 600;
    color: var(--primary);
}

/* Remove old img-based cover styles */
.post-body .post-cover img,
.post-full .post-body .post-cover img,
.cover-image {
    width: 100%;
    max-height: 150px;
    object-fit: cover;
    display: block;
    border-radius: var(--radius);
}
.post-title {
    font-size: 1.3rem;
    margin-bottom: 8px;
}
.post-title a {
    color: var(--text);
}
.post-text {
    font-size: 0.95rem;
    line-height: 1.7;
    word-wrap: break-word;
}
.post-text p { margin-bottom: 0.5em; }
.post-text img, .comment-body img {
    width: 500px;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 12px auto;
    border-radius: 4px;
    cursor: pointer;
}
@media (max-width: 600px) {
    .post-text img, .comment-body img {
        width: 100%;
        margin: 8px auto;
    }
}
.post-text blockquote {
    border-left: 3px solid var(--primary);
    padding-left: 12px;
    color: var(--text-secondary);
    margin: 8px 0;
}
.post-text pre {
    background: #f0f0f0;
    border-radius: var(--radius);
    padding: 12px;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.4;
}
.post-text code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}
.post-text pre code {
    background: none;
    padding: 0;
}
.post-text .hashtag {
    color: var(--primary);
    font-weight: 500;
}
.post-text .mention {
    color: var(--primary);
    font-weight: 500;
}

/* Post footer */
.post-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.post-footer .views {
    cursor: default;
    border-color: transparent;
}
.post-footer .views:hover {
    background: var(--bg-card);
}

/* Post gallery — каскад как в iPhone */
.gallery-stack {
    position: relative;
    margin: 8px 0;
    cursor: pointer;
    min-height: 250px;
    overflow: hidden;
}
.gallery-stack .gallery-item {
    position: absolute;
    top: 0;
    left: 50%;
    transform-origin: center center;
    width: 35%;
    margin-left: -17%;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 12px rgba(0,0,0,0.12);
    transition: transform 0.3s ease;
    background: #fff;
}
.gallery-stack .gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.gallery-stack:hover .gallery-item {
    transform: none !important;
}
.gallery-stack:hover .gallery-item:nth-child(2) {
    transform: rotate(-1deg) translateY(-4px) !important;
}
.gallery-stack:hover .gallery-item:nth-child(3) {
    transform: rotate(1deg) translateY(-8px) !important;
}

/* Одна картинка — без каскада */
.gallery-stack[data-total="1"] .gallery-item {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    left: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Мобильные */
@media (max-width: 480px) {
    .gallery-stack {
        padding-bottom: 75%; /* чуть выше на мобильных */
    }
    .gallery-stack .gallery-item {
        width: 50%;
        margin-left: -25%;
    }
}

/* Post video */
.post-video {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    margin: 12px 0;
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 200px;
}
.post-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Video inside comments */
.comment-body .post-video {
    width: 100%;
    min-width: 280px;
}

/* Avatars */
.avatar {
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg);
}
.avatar-32 { width: 42px; height: 42px; }
.avatar-64 { width: 64px; height: 64px; }
.avatar-128 { width: 128px; height: 128px; }
.avatar-wrapper {
    position: relative;
    display: inline-block;
}
.online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: var(--online);
    border: 2px solid var(--bg-card);
    border-radius: 50%;
}
.online-dot.large {
    width: 20px;
    height: 20px;
    bottom: 4px;
    right: 4px;
}

/* Profile */
.profile-page {
    padding: 16px 0;
}
.profile-header-owner {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}
.profile-avatar-menu {
    display: flex;
    align-items: center;
    gap: 8px;
}
.profile-middle {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.profile-info {
    flex: 1;
}
.profile-nickname {
    font-size: 1.5rem;
    margin-bottom: 2px;
}
.profile-username {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 8px;
}
.profile-about,
.profile-location,
.profile-interests,
.profile-age {
    margin-bottom: 4px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.profile-last-visit {
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.profile-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    padding: 12px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}
.stat-value {
    font-weight: 700;
    font-size: 1.1rem;
}
.profile-rating {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 6px;
    font-weight: 700;
    color: #fff;
    font-size: 1.1rem;
}
.profile-rating.positive { background: #16a34a; }
.profile-rating.negative { background: #dc2626; }
.btn-danger {
    background: #dc2626;
    color: #fff;
    border: none;
}
.btn-danger:hover {
    background: #b91c1c;
}
.btn-warning {
    background: #d97706;
    color: #fff;
    border: none;
}
.btn-warning:hover {
    background: #b45309;
}
/* Admin: ban badges & actions */
.ban-badge {
    display: inline-block;
    vertical-align: middle;
    margin-left: 8px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
}
.ban-badge--full { background: #dc2626; }
.ban-badge--half { background: #d97706; }
.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 10px 12px;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 8px;
}
.admin-label {
    font-weight: 700;
    font-size: 0.85rem;
    color: #92400e;
}
.admin-sep {
    color: #b45309;
    opacity: 0.6;
    font-weight: 600;
}
.admin-bot-attack {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 6px;
    user-select: none;
}
.admin-bot-attack:hover {
    background: rgba(146, 64, 14, 0.08);
}
.bot-attack-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #92400e;
    white-space: nowrap;
}
.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.profile-actions {
    margin-bottom: 16px;
}
.profile-feed {
    margin-top: 16px;
}
.profile-feed h2 {
    margin-bottom: 12px;
}

/* Edit profile */
.edit-profile-page {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
}
.edit-profile-page h1 {
    margin-bottom: 20px;
}
.edit-avatar-section {
    text-align: center;
    margin-bottom: 24px;
}
.edit-avatar-section .avatar {
    margin-bottom: 8px;
}
.edit-avatar-section .help-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Create post */
.create-post-page {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
}
/* Editor buttons row */
.editor-buttons {
    display: flex;
    gap: 8px;
    padding: 8px;
}
.editor-buttons .btn {
    font-size: 0.85rem;
    cursor: pointer;
}
.gallery-editor-badge {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    padding: 4px 10px;
    font-size: 0.85rem;
    cursor: default;
    user-select: none;
    font-weight: 500;
}
.gallery-bar {
    padding: 6px 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-top: none;
    border-bottom: none;
}
/* Rich text editor */
.rich-editor {
    min-height: 200px;
    padding: 12px;
    border: none;
    border-radius: var(--radius) var(--radius) 0 0;
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg-card);
    outline: none;
    word-wrap: break-word;
    overflow-y: auto;
}
.rich-editor:empty::before {
    content: attr(placeholder);
    color: #999;
    pointer-events: none;
}
.drop-zone {
    padding: 16px;
    border-top: 1px dashed var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: background 0.15s;
}
.drop-zone.dragover {
    background: var(--primary-light);
    border-color: var(--primary);
}
.drop-zone .btn-link {
    cursor: pointer;
}

/* Comments */
.comments-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 20px;
    overflow-x: hidden;
}
.comments-section h2 {
    margin-bottom: 16px;
    font-size: 1.1rem;
}
.comment-form {
    margin-bottom: 16px;
}
.comment-form textarea {
    margin-bottom: 8px;
    min-height: 60px;
}
.comment-form-upload {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.comment-form-img-preview {
    display: inline-block;
    vertical-align: middle;
}
.upload-dots span {
    animation: dotBounce 1.2s infinite;
    font-size: 1.2rem;
    font-weight: 700;
    color: #999;
    display: inline-block;
}
.upload-dots span:nth-child(2) { animation-delay: 0.2s; }
.upload-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
    30% { transform: translateY(-4px); opacity: 1; }
}
.comment {
    margin-bottom: 12px;
}
.comment .comment-header {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
}
.comment-author {
    display: flex;
    align-items: center;
    gap: 8px;
}
.comment-author-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}
.comment-guest-name {
    color: var(--text-muted);
    font-style: italic;
}
.comment-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.comment-modal .modal-footer .btn-primary {
    width: 100%;
}
.comment-rating {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 5px;
    margin-left: 6px;
    color: #fff;
    line-height: 1.4;
}
.comment-rating.positive { background: #16a34a; }
.comment-rating.negative { background: #dc2626; }
/* Toast notification */
.toast {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: #16a34a;
    color: #fff;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast-error {
    background: #dc2626;
}
/* Exclusions page */
.exclusions-page {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
}
.exclusions-section {
    margin-bottom: 24px;
}
.exclusions-section h2 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}
.exclusions-empty {
    color: var(--text-muted);
    font-size: 0.9rem;
}
.exclusions-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.exclusions-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.exclusions-user {
    display: flex;
    align-items: center;
    gap: 8px;
}
.exclusions-name {
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--text);
}
.exclusions-name:hover {
    text-decoration: underline;
}
.exclusions-username {
    font-size: 0.8rem;
    color: var(--text-muted);
}
/* Settings page */
.settings-page {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
}
.settings-form {
    margin-top: 16px;
}
.settings-section {
    margin-bottom: 20px;
}
.settings-section h2 {
    font-size: 1.05rem;
    margin-bottom: 10px;
}
.settings-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
}
.settings-toggle .toggle-switch {
    flex-shrink: 0;
}
.alert-success {
    background: #dcfce7;
    color: #16a34a;
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 12px;
    font-size: 0.9rem;
}
.comment-likes-static {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-right: 8px;
}
.c-like {
    color: #16a34a;
    font-weight: 700;
}
.c-dislike {
    color: #dc2626;
    font-weight: 700;
}
.comment-body {
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 6px;
    word-wrap: break-word;
}
.comment-author-name {
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    color: var(--text);
}
.comment-body p { margin-bottom: 0.3em; }
.comment-body blockquote {
    border-left: 2px solid var(--primary);
    padding-left: 8px;
    color: var(--text-secondary);
    margin: 4px 0;
}
.comment-body code {
    background: #f0f0f0;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.85em;
}
.comment-footer {
    display: flex;
    gap: 4px;
    align-items: center;
}
.comment-replies {
    margin-left: 20px;
    margin-top: 4px;
    padding-left: 8px;
}
/* Mobile — убираем линии ветвления */
@media (max-width: 480px) {
    .comment-replies {
        margin-left: 0;
        padding-left: 0;
    }
}
/* Кнопка перехода к родительскому комментарию (десктоп) */
.comment-reply-to {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 50%;
    background: var(--bg);
    border: 1px solid var(--border);
    flex-shrink: 0;
    margin-right: 2px;
    line-height: 1;
}
.comment-reply-to:hover {
    color: var(--primary);
    border-color: var(--primary);
}
.comment-guest .comment-body {
    color: var(--text-muted);
}
.comment-highlight {
    animation: commentFade 3s ease-out;
}
@keyframes commentFade {
    0%   { background: #fef9c3; }
    100% { background: transparent; }
}
.comment-content {
    border-radius: var(--radius);
}
.comment-reply-form {
    margin: 8px 0;
}
.comment-modal {
    max-width: 630px;
}
.comment-modal-body {
    padding: 12px 16px;
}
.comment-modal-body textarea {
    width: 100%;
    min-height: 300px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    outline: none;
}
@media (max-width: 480px) {
    .comment-modal {
        max-width: 90vw !important;
        width: 90vw;
    }
}
.comment-modal-body textarea:focus {
    border-color: var(--primary);
}
.comment-modal-upload {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.comment-reply-form textarea {
    min-height: 40px;
    font-size: 0.85rem;
}
.load-replies {
    margin-top: 4px;
    font-size: 0.8rem;
}
.no-comments {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
    padding: 20px 0;
}

/* Feed */
.feed-page h1 {
    margin-bottom: 20px;
    font-size: 1.3rem;
}
.feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.feed-header h1 {
    margin-bottom: 0;
}

/* Toggle switch */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}
.toggle-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.toggle-slider {
    position: relative;
    width: 36px;
    height: 20px;
    background: var(--border);
    border-radius: 10px;
    transition: background 0.2s;
}
.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}
.toggle-switch input {
    display: none;
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}
.toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(16px);
}

.feed-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}
.feed-sentinel {
    text-align: center;
    padding: 20px;
}
.feed-loading {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Static lightbox — для inline-изображений из !![]() и комментариев */
#lightbox, .lightbox {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.95);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
}
#lightbox .lightbox-close {
    position: fixed;
    top: 12px;
    right: 16px;
    font-size: 2rem;
    color: #fff;
    background: rgba(0,0,0,0.4);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 2001;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
#lightbox .lightbox-close:hover { background: rgba(255,255,255,0.2); }
#lightbox #lightbox-img {
    max-width: 95vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
}

/* Lightbox — полноэкранный с навигацией */
.gallery-lightbox {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.95);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.lightbox-close {
    position: fixed;
    top: 12px;
    right: 16px;
    font-size: 2rem;
    color: #fff;
    background: rgba(0,0,0,0.4);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 2001;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.lightbox-close:hover { background: rgba(255,255,255,0.2); }

.lightbox-prev, .lightbox-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.5rem;
    color: #fff;
    background: rgba(0,0,0,0.4);
    border: none;
    width: 50px;
    height: 80px;
    border-radius: 8px;
    cursor: pointer;
    z-index: 2001;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
}
.lightbox-prev { left: 8px; }
.lightbox-next { right: 8px; }
.lightbox-prev:hover, .lightbox-next:hover { background: rgba(255,255,255,0.25); }

.lightbox-counter {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    background: rgba(0,0,0,0.5);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    z-index: 2001;
}

.lightbox-image-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 20px;
    touch-action: pan-y;
}
.lightbox-image {
    max-width: 95vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
}

@media (max-width: 600px) {
    .lightbox-prev, .lightbox-next {
        width: 40px;
        height: 56px;
        font-size: 1.8rem;
    }
    .lightbox-prev { left: 4px; }
    .lightbox-next { right: 4px; }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}
.empty-state h1 {
    font-size: 2rem;
    margin-bottom: 8px;
    color: var(--text-muted);
}
.empty-state p {
    color: var(--text-secondary);
}

/* Success / Error messages */
.success-msg {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: var(--success);
    padding: 8px 12px;
    border-radius: var(--radius);
    margin-bottom: 12px;
}
.error-msg {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--danger);
    padding: 8px 12px;
    border-radius: var(--radius);
    margin-bottom: 12px;
}

/* Post full */
.post-full {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .container { padding: 0 12px; }
    .post-card { padding: 12px; }
    .post-title { font-size: 1.1rem; }
    .profile-stats { gap: 8px; }
    .stat-item { min-width: 50px; }
    .stat-value { font-size: 1rem; }
    .comment-replies { margin-left: 4px; padding-left: 3px; }

    .post-header .post-time {
        order: 1;
    }

    .post-header .post-menu-btn {
        order: 1;
    }
}

/* Tablet */
@media (min-width: 768px) {
    .container { max-width: 1200px; }
    .post-gallery { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

/* Desktop */
@media (min-width: 1024px) {
    .container { max-width: 1200px; }
}

/* ========================================
   KnowItAll — term tooltips
   ======================================== */
.know-term {
    color: #c9a84c;
    cursor: help;
    border-bottom: 1px dashed #c9a84c;
    position: relative;
}
.know-term:hover { color: #e0c565; }
.know-tooltip {
    display: none;
    position: fixed;
    z-index: 10001;
    background: #1e1e2e;
    border: 1px solid #c9a84c;
    border-radius: 8px;
    padding: 12px 14px;
    max-width: 350px;
    min-width: 200px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.5);
    font-size: 14px;
    line-height: 1.6;
    color: #e0d5c1;
    pointer-events: auto;
}
.know-tooltip p { margin: 0 0 8px; }
.know-tooltip p:last-child { margin-bottom: 0; }
.know-loading {
    color: #888;
    font-style: italic;
}
.know-ask-more {
    display: inline-block;
    margin-top: 8px;
    background: #c9a84c;
    color: #1a1a2e;
    border: none;
    padding: 5px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
}
.know-ask-more:hover { background: #d4b65a; }

/* ========================================
   KnowItAll — chat modal
   ======================================== */
.know-chat-modal {
    display: none;
    position: fixed; inset: 0; z-index: 10002;
    align-items: center; justify-content: center;
}
.know-chat-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.6);
}
.know-chat-window {
    position: relative;
    width: 420px; max-width: 95vw; max-height: 80vh;
    background: #1e1e2e;
    border: 1px solid #c9a84c;
    border-radius: 12px;
    display: flex; flex-direction: column;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
.know-chat-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #333;
    color: #c9a84c; font-weight: bold; font-size: 15px;
}
.know-chat-close {
    background: none; border: none; color: #c9a84c;
    font-size: 20px; cursor: pointer; opacity: 0.7;
}
.know-chat-close:hover { opacity: 1; }
.know-chat-body {
    flex: 1; overflow-y: auto;
    padding: 12px 16px;
    min-height: 200px; max-height: 50vh;
    display: flex; flex-direction: column; gap: 8px;
}
.know-msg {
    max-width: 85%; padding: 8px 12px;
    border-radius: 8px; font-size: 14px; line-height: 1.5;
    word-wrap: break-word;
}
.know-msg-user {
    align-self: flex-end;
    background: #c9a84c; color: #1a1a2e;
}
.know-msg-bot {
    align-self: flex-start;
    background: #2a2a3e; color: #e0d5c1;
}
.know-chat-input-row {
    display: flex; gap: 6px;
    padding: 10px 16px;
    border-top: 1px solid #333;
}
.know-chat-input-row input {
    flex: 1;
    background: #2a2a3e; color: #e0d5c1;
    border: 1px solid #444; border-radius: 6px;
    padding: 8px 12px; font-size: 14px;
    outline: none;
}
.know-chat-input-row input:focus { border-color: #c9a84c; }
.know-chat-input-row button {
    background: #c9a84c; color: #1a1a2e;
    border: none; border-radius: 6px;
    padding: 8px 14px; font-size: 18px; cursor: pointer;
    font-weight: bold;
}
.know-chat-input-row button:hover { background: #d4b65a; }

/* Guest tooltip — registration prompt */
.know-term-guest .know-tooltip {
    font-size: 13px;
    padding: 10px 14px;
    text-align: center;
    min-width: 180px;
    white-space: nowrap;
}
.know-term-guest .know-tooltip a {
    color: #c9a84c;
    font-weight: bold;
    text-decoration: underline;
}
.know-term-guest .know-tooltip a:hover { color: #e0c565; }
.know-term:hover .know-tooltip,
.know-term-guest:hover .know-tooltip { display: block; }

/* ===== Боковая «Сводка» активности (заметка: блок в правом сайдбаре) ===== */
.sidebar-activity {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin: 12px;
}
.sidebar-activity-header {
    padding: 10px 12px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.sidebar-activity-list {
    max-height: 60vh;
    overflow-y: auto;
}
.activity-item {
    display: flex;
    gap: 10px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}
.activity-item:last-child {
    border-bottom: none;
}
.activity-item:hover {
    background: var(--bg);
}
.activity-item .notif-text {
    color: var(--text);
}
.activity-item .activity-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.sidebar-activity-empty {
    padding: 20px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.act-go {
    text-decoration: none;
}

/* ===== Мобильная кнопка «События» + модалка сводки ===== */
/* По умолчанию (десктоп, где сайдбар виден) — кнопку скрываем */
.nav-events-btn {
    display: none;
}
/* Модалка «События» — широкая на всех размерах */
.events-modal {
    width: 440px;
    max-width: 92vw;
}
.events-modal .notif-list {
    max-height: 70vh;
    overflow-y: auto;
}

/* ===== Мобильные: показать кнопку, скрыть десктоп-сайдбар (как и раньше) ===== */
@media (max-width: 768px) {
    .nav-events-btn {
        display: inline-block;
    }
    /* Полноэкранная мобильная модалка */
    .events-modal {
        width: 94vw;
        max-width: 94vw;
        max-height: 88vh;
    }
}
