/* ===== Variables ===== */
:root {
    --header-h: 56px;
    --sidebar-w: 280px;
    --right-sidebar-w: 380px;
    --radius: 12px;
    --radius-sm: 8px;
    --bg: #f0f2f5;
    --bg-card: #fff;
    --bg-hover: #f5f6f8;
    --bg-active: #e8f0fe;
    --text: #1c1e21;
    --text-secondary: #65676b;
    --text-muted: #8a8d91;
    --accent: #1a73e8;
    --accent-hover: #1557b0;
    --black-indigo:rgb(28, 79, 113);
    --accent-light: #e8f0fe;
    --border: #e4e6eb;
    --shadow: 0 1px 2px rgba(0,0,0,0.06);
    --shadow-hover: 0 2px 12px rgba(0,0,0,0.1);
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'Ubuntu Mono', 'Fira Code', Consolas, monospace;
}

/* ===== Theme: Dark ===== */
body.theme-dark {
    --bg: #18191a; --bg-card: #242526; --bg-hover: #3a3b3c; --bg-active: #263850;
    --text: #e4e6eb; --text-secondary: #b0b3b8; --text-muted: #6a6d72;
    --border: #3e4042;
    --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-hover: 0 2px 12px rgba(0,0,0,.4);
    --accent: #4dabf7; --accent-hover: #3794e0; --accent-light: #1a3a5c;
}

/* ===== Theme: Warm / Sepia ===== */
body.theme-warm {
    --bg: #faf6f0; --bg-card: #fffdf7; --bg-hover: #f5ede0; --bg-active: #fdf2e0;
    --text: #3e3222; --text-secondary: #6b5e4a; --text-muted: #9b8d7a;
    --accent: #c7762c; --accent-hover: #a55e1e; --accent-light: #fdf2e0;
    --border: #e5d9c5;
}

/* ===== Theme: Green ===== */
body.theme-green {
    --bg: #f2f7f4; --bg-card: #fff; --bg-hover: #e8f2ea; --bg-active: #d4edda;
    --text: #1a2e1f; --text-secondary: #4a6b50; --text-muted: #7d9a82;
    --accent: #2d8a4e; --accent-hover: #236e3d; --accent-light: #d4edda;
    --border: #c8e0cc;
}

/* ===== Theme: Purple ===== */
body.theme-purple {
    --bg: #f7f5fa; --bg-card: #fff; --bg-hover: #f0ecf6; --bg-active: #ede4f6;
    --text: #262133; --text-secondary: #5a5570; --text-muted: #8b86a0;
    --accent: #7c3aed; --accent-hover: #6d28d9; --accent-light: #ede4f6;
    --border: #dcd6e8;
}

/* ===== Theme: Rose ===== */
body.theme-rose {
    --bg: #faf5f7; --bg-card: #fff; --bg-hover: #f8f0f3; --bg-active: #fce4ec;
    --text: #2d1a23; --text-secondary: #6b4d5a; --text-muted: #9b7d8a;
    --accent: #d6336c; --accent-hover: #b92c5a; --accent-light: #fce4ec;
    --border: #e8d0d8;
}

/* ===== Theme: Cyan ===== */
body.theme-cyan {
    --bg: #f2f8f9; --bg-card: #fff; --bg-hover: #e4f2f5; --bg-active: #cfecf2;
    --text: #163135; --text-secondary: #3d6368; --text-muted: #699499;
    --accent: #0d7c8a; --accent-hover: #096470; --accent-light: #cfecf2;
    --border: #c0dbdf;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.55; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ===== Top Bar ===== */
.top-bar {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--header-h);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
}
.top-bar-inner {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--right-sidebar-w);
    align-items: center;
    height: 100%;justify-content: space-between;
    margin: 0 auto; padding: 0 20px;
}
.top-bar-write .top-bar-inner,
.top-bar-images .top-bar-inner {
    display: flex;
}
.top-bar-left {
    display: flex; align-items: center; gap: 8px;
}
.top-bar-center {
    display: flex; align-items: center; gap: 8px;
    justify-self: center; width: 100%; max-width: 560px;min-width: 260px;
}
.top-bar-brand,
.top-bar-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: var(--text);
}
.top-bar-brand:hover,
.top-bar-brand-link:hover { color: var(--accent); }
.top-bar-brand-icon,
.top-bar-brand .custom-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
}
.top-bar-brand-name {
    font-size: 20px;
    font-weight: 800;
    color: inherit;
    letter-spacing: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-bar-search {
    max-width: 520px; margin: 0 auto; width: 100%;
}
.top-bar-search input {
    width: 100%; padding: 9px 16px 9px 38px;
    border: 1px solid var(--border); border-radius: 24px;
    background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238a8d91' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") 14px center no-repeat;
    font-size: 14px; outline: none;
    transition: border-color .2s, background .2s;
}
.top-bar-search input:focus {
    border-color: var(--accent); background-color: var(--bg-card);
}

.top-bar-write-btn {
    flex-shrink: 0;
    width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; font-size: 18px;
    background: var(--bg); border: 1px solid var(--border);
    transition: background .15s, border-color .15s, transform .15s;
}
.top-bar-write-btn:hover {
    background: var(--accent); border-color: var(--accent); color: #fff;
    transform: scale(1.05);
}

.top-bar-actions { display: flex; align-items: center; gap: 12px; justify-self: end; }
.top-bar-user {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 10px 4px 4px; border-radius: 24px;
    cursor: pointer; transition: background .15s;
    background: #e2e2e2;
}
.top-bar-user:hover { background: var(--bg-hover); }
.top-bar-user img, .top-bar-user .avatar-placeholder { width: 32px; height: 32px; border-radius: 50%; }
.top-bar-user .avatar-placeholder { display: inline-flex; align-items: center; justify-content: center; font-size: 24px; background: var(--bg-hover); }
.top-bar-username { font-size: 14px; font-weight: 600; white-space: nowrap; }
.top-bar-login {
    padding: 8px 20px; border-radius: 24px;
    background: var(--accent); color: #fff; font-weight: 600; font-size: 14px;
}
.top-bar-login:hover { background: var(--accent-hover); color: #fff; }

/* User dropdown */
.top-bar-user-dropdown { position: relative; }
.top-bar-user .user-dropdown-arrow {
    font-size: 10px; margin-left: 2px; color: var(--text-muted); transition: transform .2s;
}
.top-bar-user-dropdown.open .user-dropdown-arrow { transform: rotate(180deg); }
.user-dropdown-menu {
    display: none; position: absolute; top: calc(100% + 6px); right: 0;
    min-width: 160px; background: #fff; border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,.12); z-index: 200; padding: 6px 0;
}
.top-bar-user-dropdown.open .user-dropdown-menu { display: block; }
.user-dropdown-item {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 16px; font-size: 14px; color: var(--text);
    transition: background .12s;
}
.user-dropdown-item:hover { background: var(--bg-hover); }
.user-dropdown-item span { font-size: 16px; }
.user-dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }
.user-dropdown-logout { color: var(--text-muted); }

.menu-toggle {
    display: none; flex-direction: column; gap: 4px;
    padding: 8px; background: none; border: none;
}
.menu-toggle span {
    display: block; width: 18px; height: 2px;
    background: var(--text); border-radius: 1px; transition: transform .2s;
}

/* ===== Site Layout (3-column grid) ===== */
.site-layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--right-sidebar-w);
    min-height: 100vh;
    padding-top: var(--header-h);
}

/* ===== Left Sidebar ===== */
.sidebar-nav {
    position: sticky; top: var(--header-h);
    height: calc(100vh - var(--header-h));
    overflow-y: auto; padding: 8px;
    border-right: 1px solid var(--border);
    background: var(--bg-card);
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 14px; border-radius: var(--radius-sm);
    color: var(--text); font-size: 14px; font-weight: 500;
    transition: background .12s;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.nav-item-icon { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; }
.nav-item-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item-count {
    font-size: 12px; color: var(--text-muted);
    background: var(--bg); padding: 1px 8px; border-radius: 10px;
}
.nav-divider { height: 1px; background: var(--border); margin: 8px 14px; }
.nav-section-title {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    color: var(--text-muted); padding: 14px 14px 4px; letter-spacing: .6px;
}

/* ===== Main Feed ===== */
.main-feed {
    padding: 20px;
    min-width: 0;
    margin: 0 auto;
    width: 100%; 
}
.feed-header {
    background: var(--bg-card); border-radius: var(--radius);
    border: 1px solid var(--border); padding: 20px 24px; margin-bottom: 16px;
}
.feed-header h1 {
    font-size: 20px; font-weight: 700; color: var(--text);
}
.feed-header p {
    font-size: 14px; color: var(--text-secondary); margin-top: 4px;
}

/* Breadcrumb */
.breadcrumb {
    margin-bottom: 12px; padding: 8px 0;
}
.breadcrumb ol {
    list-style: none; display: flex; align-items: center; flex-wrap: wrap;
    gap: 4px; margin: 0; padding: 0;
}
.breadcrumb-item {
    font-size: 14px; color: var(--text-muted); display: flex; align-items: center; gap: 4px;
}
.breadcrumb-item:not(:last-child)::after {
    content: '/'; color: var(--text); margin-left: 2px;
}
.breadcrumb-item a {
    color: var(--text-secondary); transition: color .12s;
}
.breadcrumb-item a:hover { color: var(--accent); }
.breadcrumb-item.active span { color: var(--text); font-weight: 500; }

/* ===== Post Card ===== */
.post-card {
    background: var(--bg-card); border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 20px; margin-bottom: 12px;
    transition: box-shadow .2s;
}
.post-card:hover { box-shadow: var(--shadow-hover); }

.post-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.post-card-avatar img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.post-card-avatar .avatar-placeholder { width: 36px; height: 36px; border-radius: 50%; font-size: 22px; }
.avatar-placeholder { display: inline-flex; align-items: center; justify-content: center; background: var(--bg-hover); }
.post-card-meta { line-height: 1.3; }
.post-card-author { font-size: 14px; font-weight: 600; color: var(--text); }
.post-card-author:hover { color: var(--accent); }
.post-card-date { font-size: 12px; color: var(--text-muted); }

.post-type-badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px;
    background: var(--accent-light, #eff6ff); color: var(--accent, #2563eb);
    margin-bottom: 6px; line-height: 1.5;
}
.post-type-badge-icon { font-size: 12px; line-height: 1; }
.post-type-badge--single { font-size: 12px; padding: 3px 10px; margin-bottom: 10px; }
.post-type-badge--meta {
    font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 8px;
    background: var(--accent-light, #eff6ff); color: var(--accent, #2563eb);
    line-height: 1.5; vertical-align: middle;margin-bottom: 0;
}

/* Post type filter bar */
.post-type-filter {
    display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto;
    padding: 10px 0 12px; scrollbar-width: none;
}
.post-type-filter::-webkit-scrollbar { display: none; }
.post-type-filter-item {
    flex-shrink: 0; white-space: nowrap;
    padding: 5px 14px; border-radius: 20px; font-size: 13px; font-weight: 600;
    border: 1.5px solid var(--border); color: var(--text-secondary);
    background: var(--bg-card); transition: all .15s;
}
.post-type-filter-item:hover {
    border-color: var(--accent); color: var(--accent);
    background: var(--accent-light, #eff6ff);
}
.post-type-filter-item.active {
    border-color: var(--accent); background: var(--accent);
    color: #fff;
}

/* Lazy image: placeholder background + fade-in on load */
img[loading="lazy"] {
    background-color: var(--bg-secondary, #f3f4f6);
}
img[loading="lazy"].img-fade {
    animation: imgFadeIn 0.35s ease forwards;
}
@keyframes imgFadeIn {
    from { opacity: 0.2; }
    to   { opacity: 1; }
}

.post-card-title { font-size: 18px; font-weight: 700; line-height: 1.35; margin-bottom: 8px; }
.post-card-title a { color: var(--text); }
.post-card-title a:hover { color: var(--accent); }

.post-card-excerpt {
    font-size: 14px; color: var(--text-secondary);
    line-height: 1.65; margin-bottom: 12px;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

.post-card-thumbnail {
    border-radius: var(--radius-sm); overflow: hidden;
    margin-bottom: 12px; aspect-ratio: 16/9;
}
.post-card-thumbnail img { width: 100%; height: 100%; object-fit: cover; }

/* Unified gallery preview card */
.post-card-gallery {
    display: grid; gap: 3px; border-radius: var(--radius-sm);
    overflow: hidden; margin-bottom: 12px;
}
.post-card-gallery[data-count="1"] { grid-template-columns: 1fr; }
.post-card-gallery[data-count="2"] { grid-template-columns: 1fr 1fr; }
.post-card-gallery[data-count="3"] { grid-template-columns: repeat(3, 1fr); }
.post-card-gallery[data-count="4"] { grid-template-columns: 1fr 1fr; }
.post-card-gallery[data-count="5"],
.post-card-gallery[data-count="6"] { grid-template-columns: repeat(3, 1fr); }
.post-card-gallery[data-count="5"] .post-card-gallery-item:nth-child(-n+2) { grid-column: span 1; }
.post-card-gallery[data-count="7"],
.post-card-gallery[data-count="8"],
.post-card-gallery[data-count="9"] { grid-template-columns: repeat(3, 1fr); }

.post-card-gallery-item {
    display: block; overflow: hidden; position: relative; aspect-ratio: 4/3;
}
.post-card-gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

.post-card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.post-card-tag {
    font-size: 12px; padding: 2px 10px; border-radius: 12px;
    background: var(--bg); color: var(--text-secondary);
    transition: background .12s;
}
.post-card-tag:hover { background: var(--accent-light); color: var(--accent); }

.post-card-actions {
    display: flex; gap: 6px; padding-top: 10px;
    border-top: 1px solid var(--border); font-size: 13px; color: var(--text-muted);
}
.post-card-action {
    display: flex; align-items: center; gap: 5px;
    padding: 5px 10px; border-radius: 6px; transition: background .12s;
}
.post-card-action:hover { background: var(--bg-hover); color: var(--text-secondary); }
.post-card-comments-toggle { cursor: pointer; user-select: none; }
.post-like-btn {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font: inherit;
    user-select: none;
}
.post-like-btn.liked {
    color: var(--accent);
    background: var(--accent-light);
}
.post-like-btn:disabled {
    opacity: .65;
    cursor: default;
}

/* Comment preview inside post cards */
.post-card-comments-preview {
    border-top: 1px solid var(--border); margin-top: 10px; padding-top: 6px;
}
.post-card-comments-preview .comment-list,
.post-card-comments-preview .comment-list > li,.post-card-comments-preview li { list-style: none; list-style-type: none; }
.post-card-comments-preview .comment-card { padding: 10px 0; }
.post-card-comments-preview .comment-card:last-child { border-bottom: none; padding-bottom: 0; }
.post-card-comments-preview .comment-card-header img,
.post-card-comments-preview .comment-card-header .avatar-placeholder { width: 28px; height: 28px; }
.post-card-comments-preview .comment-card-nickname { font-size: 13px; }
.post-card-comments-preview .comment-card-time { font-size: 11px; }
.post-card-comments-preview .comment-card-body { font-size: 13px; }
.post-card-comments-preview .comment-card-body p { font-size: 13px; }
.post-card-comments-preview .comment-card-footer { display: none; }
.post-card-comments-preview .comment-card-edit { display: none; }
.post-card-comments-preview .children { padding-left: 16px; border-left-width: 1px; }

.comment-preview-loading,
.comment-preview-error,
.comment-preview-empty { font-size: 13px; color: var(--text-muted); padding: 8px 0; text-align: center; }
.comment-preview-error { color: #d6336c; }

/* ===== Single Post ===== */
.single-article-shell.has-progress-rail {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    column-gap: 12px;
    align-items: start;
}
.article-progress-rail {
    position: sticky;
    top: calc(var(--header-h) + 24px);
    width: 20px;
    height: calc(100vh - var(--header-h) - 48px);
    min-height: 240px;
    z-index: 5;
}
.article-progress-track {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: #d7d9dc;
    overflow: hidden;
}
.article-progress-fill {
    width: 100%;
    height: 0;
    border-radius: inherit;
    background: #6b98d6;
    transition: height .16s ease-out;
}
.article-progress-node {
    position: absolute;
    left: 50%;
    width: 12px;
    height: 12px;
    padding: 0;
    border: 2px solid var(--bg-card);
    border-radius: 50%;
    background: #95979a;
    box-shadow: 0 0 0 1px var(--border);
    cursor: pointer;
    transform: translate(-50%, -50%);
    transition: background .16s ease, box-shadow .16s ease, transform .16s ease;
}
.article-progress-node--h3 {
    width: 9px;
    height: 9px;
}
.article-progress-node:hover,
.article-progress-node:focus-visible,
.article-progress-node.active {
    background: var(--accent-hover);
    border-color: var(--bg-card);
    box-shadow: 0 0 0 3px var(--accent-light);
}
.article-progress-node:hover,
.article-progress-node:focus-visible {
    transform: translate(-50%, -50%) scale(1.2);
}
.article-progress-node-label {
    position: absolute;
    left: 18px;
    top: 50%;
    max-width: 220px;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) translateX(-4px);
    transition: opacity .16s ease, transform .16s ease;
}
.article-progress-node:hover .article-progress-node-label,
.article-progress-node:focus-visible .article-progress-node-label {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}
.single-article {
    background: var(--bg-card); border-radius: var(--radius);
    border: 1px solid var(--border); padding: 32px; margin-bottom: 16px;
}
.single-header { margin-bottom: 24px; }
.single-title { font-size: 26px; font-weight: 500; line-height: 1.3; margin-bottom: 16px; }
.single-meta {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    font-size: 14px; color: var(--text-secondary);
}
.single-meta-avatar img { width: 40px; height: 40px; border-radius: 50%; }
.single-meta-avatar .avatar-placeholder { width: 40px; height: 40px; border-radius: 50%; font-size: 26px; }
.single-meta-author { font-weight: 600; color: var(--text); }
.single-meta-item { white-space: nowrap; }
.post-card-tag--meta {
    margin: 0;
    white-space: nowrap;
}
.single-like-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 6px;
    border: 0;
    background: transparent;
}
.single-like-footer {
    display: flex;
    justify-content: center;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}
.single-like-footer .single-like-btn {
    min-width: 108px;
    justify-content: center;
    padding: 10px 18px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-weight: 600;
}
.single-like-footer .single-like-btn:hover {
    background: var(--bg-hover);
}
.single-like-footer .single-like-btn.liked {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-light);
}

.single-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }

.entry-content { font-size: 16px; line-height: 1.85; color: var(--text); }
.entry-content h1, .entry-content h2, .entry-content h3,
.entry-content h4, .entry-content h5, .entry-content h6 {
    margin-top: 1.8em; margin-bottom: .6em; font-weight: 700; line-height: 1.3;
    scroll-margin-top: calc(var(--header-h) + 16px);
}
.entry-content h2 { font-size: 22px; }
.entry-content h3 { font-size: 18px; }
.entry-content p { margin-bottom: 1.15em; }
.entry-content ul, .entry-content ol { padding-left: 1.6em; margin-bottom: 1.15em; list-style: revert; }
.entry-content li { margin-bottom: .4em; }
.entry-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.entry-content img { border-radius: var(--radius-sm); margin: 1.2em 0; }
.entry-content .video-embed {
    position: relative; width: 100%; padding-top: 56.25%;
    margin: 1.2em 0; border-radius: var(--radius-sm); overflow: hidden;
    background: #000;
}
.entry-content .video-embed iframe {
    position: absolute; inset: 0; width: 100%; height: 100%; border: none;
}
.entry-content code {
    font-family: var(--font-mono); background: var(--bg);
    padding: 2px 6px; border-radius: 4px; font-size: .88em;
}
.entry-content pre {
    position: relative;
    background: #1e1e2e; color: #cdd6f4;
    padding: 18px 22px; border-radius: var(--radius-sm);
    overflow-x: auto; font-family: var(--font-mono);
    font-size: 14px; line-height: 1.65; margin: 1.4em 0;
}
.entry-content pre code { background: none; padding: 0; font-size: inherit; }
.entry-content pre > code[class*="language-"],
.entry-content pre[class*="language-"] { background: transparent; }
.code-copy-btn {
    position: absolute; top: 10px; right: 12px;
    padding: 3px 10px; border-radius: 4px; border: none;
    background: rgba(255,255,255,.12); color: #cdd6f4;
    font-size: 12px; cursor: pointer; transition: background .15s, color .15s;
    line-height: 1.6;
}
.code-copy-btn:hover { background: rgba(255,255,255,.22); }
.entry-content blockquote {
    border-left: 4px solid var(--accent); padding: 14px 20px;
    margin: 1.4em 0; background: var(--accent-light);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary); font-style: italic;
}
.entry-content table { width: 100%; border-collapse: collapse; margin: 1.4em 0; }
.entry-content th, .entry-content td {
    padding: 10px 14px; border: 1px solid var(--border); text-align: left;
}
.entry-content th { background: var(--bg); font-weight: 600; }
.entry-content hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }

/* Single image wrapper */
.entry-content .image-single { margin: 1.2em 0; text-align: center; }
.entry-content .image-single img { margin: 0 auto; width: 100%; }

/* Gallery / image grid */
.entry-content .image-grid {
    display: grid; gap: 4px; border-radius: 8px;
    overflow: hidden; margin: 1.2em 0;
}
.entry-content .image-grid-item img {
    width: 100%; height: 100%; object-fit: cover; display: block; margin: 0;
    border-radius: 0;
}

.image-grid-2 { grid-template-columns: 1fr 1fr; }
.image-grid-2 .image-grid-item { aspect-ratio: 4/3; }

.image-grid-3 { grid-template-columns: repeat(3, 1fr); }
.image-grid-3 .image-grid-item { aspect-ratio: 4/3; }

.image-grid-4 { grid-template-columns: 1fr 1fr; }
.image-grid-4 .image-grid-item { aspect-ratio: 1; }

.image-grid-5 { grid-template-columns: repeat(6, 1fr); }
.image-grid-5 .image-grid-item:nth-child(-n+2) { grid-column: span 3; aspect-ratio: 4/3; }
.image-grid-5 .image-grid-item:nth-child(n+3) { grid-column: span 2; aspect-ratio: 4/3; }

.image-grid-6 { grid-template-columns: repeat(3, 1fr); }
.image-grid-6 .image-grid-item { aspect-ratio: 1; }

.image-grid-7 { grid-template-columns: repeat(12, 1fr); }
.image-grid-7 .image-grid-item:nth-child(-n+3) { grid-column: span 4; aspect-ratio: 4/3; }
.image-grid-7 .image-grid-item:nth-child(n+4) { grid-column: span 3; aspect-ratio: 4/3; }

.image-grid-8 { grid-template-columns: repeat(6, 1fr); }
.image-grid-8 .image-grid-item:nth-child(-n+3) { grid-column: span 2; aspect-ratio: 4/3; }
.image-grid-8 .image-grid-item:nth-child(n+4):nth-child(-n+6) { grid-column: span 2; aspect-ratio: 4/3; }
.image-grid-8 .image-grid-item:nth-child(n+7) { grid-column: span 3; aspect-ratio: 4/3; }

.image-grid-9 { grid-template-columns: repeat(3, 1fr); }
.image-grid-9 .image-grid-item { aspect-ratio: 1; }

/* ===== Post Navigation ===== */
.post-nav {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px;
}
.post-nav-item {
    background: var(--bg-card); border-radius: var(--radius);
    border: 1px solid var(--border); padding: 16px;
    transition: box-shadow .2s;
}
.post-nav-item:hover { box-shadow: var(--shadow-hover); }
.post-nav-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.post-nav-title { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.4; }
.post-nav-item:hover .post-nav-title { color: var(--accent); }
.post-nav-item.next { text-align: right; }

/* ===== Comments ===== */
.comments-area {
    background: var(--bg-card); border-radius: var(--radius);
    border: 1px solid var(--border); padding: 24px;
}
.comments-title { font-size: 18px; font-weight: 700; margin-bottom: 20px; }
.comment-list { list-style: none; }
.comment-card {
    padding: 16px 0; border-bottom: 1px solid var(--border);
}
.comment-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.comment-user-info { display: flex; align-items: center; gap: 8px; }
.comment-card-header img,
.comment-card-header .avatar-placeholder { width: 36px; height: 36px; border-radius: 50%; }
.comment-card-header .avatar-placeholder { display: inline-flex; align-items: center; justify-content: center; font-size: 22px; background: var(--bg-hover); }
.comment-card-nickname { font-weight: 600; font-size: 14px;color: #1777b6; }
.comment-card-time { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.comment-card-edit { font-size: 12px; color: var(--text-muted); text-decoration: none; }
.comment-card-edit:hover { color: var(--accent); }
.comment-card-body { font-size: 14px; line-height: 1.65; }
.comment-card-body p { margin-bottom: .6em; background: #f2f2f2;
    padding: 3px 5px;    border-radius: 5px;}
.comment-moderation { font-size: 13px; color: var(--accent); display: block; margin-bottom: 6px; }
.comment-item-pending { opacity: .65; }
.comment-item-pending .comment-card { border-left: 3px solid #e67c00; padding-left: 12px; border-radius: 4px 0 0 4px; }
.comment-badge-pending { font-size: 12px; color: #e67c00; background: #fff3e0; padding: 1px 8px; border-radius: 10px; white-space: nowrap; }
.comment-card-footer { margin-top: 8px; }
.comment-reply-link {
    font-size: 13px; color: var(--text-muted);
    padding: 4px 10px; border-radius: 6px;
}
.comment-reply-link:hover { background: var(--bg-hover); color: var(--accent); }
.comment-reply-textarea { margin-top: 8px; width: 100%; }
.comment-reply-actions { display: flex; gap: 8px; margin-top: 8px; justify-content: flex-end; }
.comment-reply-cancel,
.comment-reply-confirm { font-size: 13px; padding: 4px 14px; border-radius: 6px; border: 1px solid var(--border); cursor: pointer; }
.comment-reply-cancel { background: var(--bg); color: var(--text-muted); }
.comment-reply-cancel:hover { background: var(--bg-hover); }
.comment-reply-confirm { background: var(--accent); color: #fff; border-color: var(--accent); }
.comment-reply-confirm:hover { opacity: .85; }
.children { padding-left: 24px; border-left: 2px solid var(--border); }

/* Keep old comment-body for backward compat */
.comment-body {
    padding: 16px 0; border-bottom: 1px solid var(--border);
}
.comment-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.comment-author img { width: 32px; height: 32px; border-radius: 50%; }
.comment-author .fn { font-weight: 600; font-size: 14px; }
.comment-metadata { font-size: 12px; color: var(--text-muted); }
.comment-content { font-size: 14px; line-height: 1.65; }
.comment-content p { margin-bottom: .6em; }

.comment-respond { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.comment-reply-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.comment-form label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%; padding: 10px 14px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--bg);
    font-size: 14px; outline: none; transition: border-color .2s;
    margin-bottom: 12px;
}
.comment-form input:focus, .comment-form textarea:focus { border-color: var(--accent); background: var(--bg-card); }
.comment-form textarea { min-height: 100px; resize: vertical; }
.comment-form .submit {
    padding: 10px 24px; border: none; border-radius: var(--radius-sm);
    background: var(--accent); color: #fff; font-weight: 600;
    font-size: 14px; transition: background .15s;
}
.comment-form .submit:hover { background: var(--accent-hover); }

/* ===== 自定义评论表单 ===== */
.comment-form-wrap { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.comment-form-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px; flex-wrap: wrap; gap: 6px;
}
.comment-user-info { display: flex; align-items: center; gap: 8px; }
.comment-form-avatar img,
.comment-form-avatar .avatar-placeholder {
    width: 36px; height: 36px; border-radius: 50%; vertical-align: middle;
}
.comment-form-nickname { font-size: 14px; font-weight: 600; color: var(--text); }
.comment-form-description { font-size: 12px; color: var(--text-muted); }
.comment-textarea {
    display: block; width: 100%; box-sizing: border-box;
    padding: 10px 14px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--bg);
    font-size: 14px; outline: none; resize: vertical;
    transition: border-color .2s; color: var(--text); font-family: inherit;
}
.comment-textarea:focus { border-color: var(--accent); background: var(--bg-card); }
.comment-submit-btn {
    margin-top: 10px; padding: 8px 22px; border: none;
    border-radius: var(--radius-sm); background: var(--accent); color: #fff;
    font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s;
}
.comment-submit-btn:hover:not(:disabled) { background: var(--accent-hover); }
.comment-submit-btn:disabled { opacity: .6; cursor: not-allowed; }
.comment-submit-spinner {
    display: none; width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff; border-radius: 50%;
    animation: cm-spin .5s linear infinite;
    vertical-align: middle;
}
@keyframes cm-spin { to { transform: rotate(360deg); } }

/* ===== 验证码弹窗 ===== */
@keyframes captcha-overlay-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes captcha-card-in {
    from { opacity: 0; transform: scale(.92) translateY(-8px); }
    to   { opacity: 1; transform: scale(1)   translateY(0); }
}

.comment-captcha-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    align-items: center; justify-content: center;
    padding: 16px;
}
.comment-captcha-overlay.active {
    display: flex;
    animation: captcha-overlay-in .18s ease;
}
.comment-captcha-overlay.active .comment-captcha-card {
    animation: captcha-card-in .22s cubic-bezier(.34,1.3,.64,1);
}

.comment-captcha-card {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    padding: 28px 28px 24px;
    width: 340px; max-width: 100%;
}

/* ── 标题区 ── */
.comment-captcha-card h4 {
    font-size: 15px; font-weight: 700;
    color: var(--text); margin-bottom: 20px;
    padding-right: 28px;
    display: flex; align-items: center; gap: 7px;
}
.comment-captcha-card h4::before {
    content: '🔐';
    font-size: 15px;
}

/* ── 关闭按钮 ── */
.comment-captcha-close {
    position: absolute; top: 12px; right: 12px;
    width: 28px; height: 28px; border-radius: 50%;
    background: none; border: none;
    font-size: 16px; line-height: 28px; text-align: center;
    color: var(--text-muted); cursor: pointer;
    transition: background .12s, color .12s;
}
.comment-captcha-close:hover {
    background: var(--bg-hover); color: var(--text);
}

/* ── 验证码图片行 ── */
.comment-captcha-row {
    display: flex; align-items: stretch; gap: 8px; margin-bottom: 12px;
}
.comment-captcha-img {
    height: 44px; min-width: 110px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer; background: var(--bg-hover);
    flex-shrink: 0; object-fit: cover;
    transition: opacity .15s;
}
.comment-captcha-img:hover { opacity: .82; }

/* ── 输入框 ── */
.comment-captcha-row input[type="text"] {
    flex: 1; min-width: 0;
    padding: 0 12px; height: 44px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    text-align: center;
    color: var(--text); outline: none;
    transition: border-color .18s, box-shadow .18s;
}
.comment-captcha-row input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
    background: var(--bg-card);
}

/* ── 刷新按钮 ── */
.comment-captcha-refresh {
    width: 44px; height: 44px; flex-shrink: 0;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    font-size: 17px; line-height: 42px; text-align: center;
    color: var(--text-secondary); cursor: pointer;
    transition: background .12s, border-color .12s, transform .18s;
}
.comment-captcha-refresh:hover {
    background: var(--bg-hover); border-color: var(--accent);
    transform: rotate(30deg);
}

/* ── 倒计时 ── */
.comment-captcha-countdown {
    display: block; font-size: 12px;
    color: var(--text-muted); min-height: 18px;
    margin-bottom: 16px; text-align: right;
}

/* ── 操作按钮 ── */
.comment-captcha-actions {
    display: flex; gap: 8px;
}
.comment-captcha-btn-cancel {
    flex: 0 0 auto;
    padding: 0 18px; height: 40px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    background: var(--bg); color: var(--text-secondary);
    font-size: 14px; cursor: pointer;
    transition: background .12s, border-color .12s;
}
.comment-captcha-btn-cancel:hover {
    background: var(--bg-hover); border-color: var(--text-muted);
}
.comment-captcha-btn-confirm {
    flex: 1;
    height: 40px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--accent); color: #fff;
    font-size: 14px; font-weight: 600;
    cursor: pointer; letter-spacing: .04em;
    transition: background .15s, box-shadow .15s, transform .1s;
    box-shadow: 0 2px 8px rgba(26,115,232,.25);
}
.comment-captcha-btn-confirm:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 14px rgba(26,115,232,.35);
}
.comment-captcha-btn-confirm:active { transform: scale(.97); }

/* ===== Right Sidebar ===== */
.right-sidebar {
    position: sticky; top: var(--header-h);
    height: calc(100vh - var(--header-h));
    overflow-y: auto; padding: 20px 16px;
}
.right-sidebar::-webkit-scrollbar { width: 3px; }
.right-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.sidebar-widget {
    background: var(--bg-card); border-radius: var(--radius);
    border: 1px solid var(--border); padding: 16px; margin-bottom: 12px;
}
.sidebar-widget-title {
    font-size: 15px; font-weight: 700; margin-bottom: 12px;
    padding-bottom: 10px; border-bottom: 1px solid var(--border);
}

.sidebar-post-item {
    display: flex; align-items: baseline; gap: 8px;
    padding: 8px 0; border-bottom: 1px solid var(--bg);
    color: var(--text); transition: color .12s;
}
.sidebar-post-item:last-child { border-bottom: none; }
.sidebar-post-item:hover { color: var(--accent); }
.sidebar-post-rank {
    flex-shrink: 0; width: 20px; font-size: 12px;
    font-weight: 700; color: var(--text-muted); text-align: center;
}
.sidebar-post-title {
    flex: 1; font-size: 14px; font-weight: 500; line-height: 1.4;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-post-date { flex-shrink: 0; font-size: 12px; color: var(--text-muted); }

.sidebar-cat-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 7px 10px; border-radius: 6px;
    color: var(--text); font-size: 14px; transition: background .12s;
}
.sidebar-cat-item:hover { background: var(--bg-hover); }
.sidebar-cat-count {
    font-size: 12px; color: var(--text-muted);
    background: var(--bg); padding: 1px 8px; border-radius: 10px;
}

.sidebar-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.sidebar-tag {
    font-size: 12px; padding: 4px 12px; border-radius: 14px;
    background: var(--bg); color: var(--text-secondary);
    transition: background .12s, color .12s;
}
.sidebar-tag:hover { background: var(--accent-light); color: var(--accent); }

/* ===== Pagination ===== */
.navigation.pagination { margin-top: 8px; }
.nav-links {
    display: flex; justify-content: center; gap: 4px; flex-wrap: wrap;
}
.nav-links .page-numbers {
    display: flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px; padding: 0 10px;
    border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
    color: var(--text); background: var(--bg-card);
    border: 1px solid var(--border); transition: all .12s;
}
.nav-links .page-numbers:hover { border-color: var(--accent); color: var(--accent); }
.nav-links .page-numbers.current {
    background: var(--accent); color: #fff; border-color: var(--accent);
}
.nav-links .page-numbers.dots { border: none; background: none; }

/* ===== Footer ===== */
.site-footer {
    text-align: center; padding: 24px 20px;
    font-size: 13px; color: var(--text-muted);
    border-top: 1px solid var(--border); background: var(--bg-card);
}

/* ===== 404 ===== */
.error-404 {
    text-align: center; padding: 60px 20px;
    background: var(--bg-card); border-radius: var(--radius);
    border: 1px solid var(--border);
}
.error-404 .error-code { font-size: 80px; font-weight: 800; color: var(--border); line-height: 1; }
.error-404 .page-title { font-size: 22px; font-weight: 700; margin: 16px 0 8px; }
.error-404 p { color: var(--text-secondary); margin-bottom: 24px; }
.error-404 .search-form { margin: 0 auto; }

/* ===== Search Form ===== */
.search-form { max-width: 480px; }

.search-form-inner {
    display: flex; align-items: center;
    border: 1px solid var(--border); border-radius: 28px;
    background: var(--bg); overflow: hidden;
    transition: border-color .2s, box-shadow .2s;
}
.search-form-inner:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.search-form-icon {
    flex-shrink: 0; width: 38px; height: 20px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238a8d91' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") center/16px no-repeat;
}

.search-form-input {
    flex: 1; min-width: 0;
    padding: 12px 0; border: none; outline: none;
    background: transparent; font-size: 15px; font-family: var(--font);
    color: var(--text);
}
.search-form-input::placeholder { color: var(--text-muted); }

.search-form-submit {
    flex-shrink: 0;
    margin: 4px 4px 4px 8px;
    padding: 8px 22px; border: none; border-radius: 24px;
    background: var(--accent); color: #fff; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: background .15s;
    font-family: var(--font);
}
.search-form-submit:hover { background: var(--accent-hover); }

/* ===== No Results ===== */
.no-results {
    text-align: center; padding: 48px 20px;
    background: var(--bg-card); border-radius: var(--radius);
    border: 1px solid var(--border);
}
.no-results .page-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.no-results p { color: var(--text-secondary); margin-bottom: 20px; }
.no-results .search-form { margin: 0 auto; }

/* ===== Mobile Sidebar Overlay ===== */
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.45); z-index: 999; opacity: 0;
    transition: opacity .25s;
}
.sidebar-overlay.active { display: block; opacity: 1; }

/* ===== TOC (Table of Contents) ===== */
.toc-widget .toc-list { display: flex; flex-direction: column; gap: 1px; }
.toc-item {
    display: block; padding: 5px 8px; border-radius: 5px; border-left: 2px solid transparent;
    font-size: 13px; line-height: 1.4; color: var(--text-secondary);
    transition: color .15s, background .15s, border-color .15s;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.toc-item:hover { color: var(--accent); background: var(--bg); }
.toc-item.active {
    color: var(--accent); background: var(--accent-light, #eff6ff);
    border-left-color: var(--accent); font-weight: 600;
}
.toc-item--h3 { padding-left: 20px; font-size: 12px; }

/* Mobile inline TOC (hidden on desktop, shown on mobile) */
.toc-mobile {
    display: none;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    margin-bottom: 24px; overflow: hidden;
}
.toc-mobile summary {
    padding: 10px 14px; font-size: 14px; font-weight: 600;
    cursor: pointer; user-select: none;
    display: flex; align-items: center; gap: 6px;
    list-style: none;
}
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary::after { content: '▾'; margin-left: auto; transition: transform .2s; }
.toc-mobile[open] summary::after { transform: rotate(180deg); }
.toc-mobile .toc-list { padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 1px; }

/* ===== Admin Bar Fixes ===== */
body.admin-bar .top-bar { top: 32px; }
body.admin-bar .site-layout { padding-top: calc(var(--header-h) + 32px); }
body.admin-bar .sidebar-nav,
body.admin-bar .right-sidebar {
    top: calc(var(--header-h) + 32px);
    height: calc(100vh - var(--header-h) - 32px);
}

/* ===== Responsive ===== */


@media (min-width: 1919px) {
   .main-feed{max-width: 90%;}
}
@media (max-width: 1100px) {
    .site-layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
    .right-sidebar { display: none; }
    .toc-mobile { display: block; }
    .single-article-shell.has-progress-rail { display: block; }
    .article-progress-rail {
        position: fixed;
        top: calc(var(--header-h) + 18px);
        right: 8px;
        width: 18px;
        height: calc(100vh - var(--header-h) - 96px);
        min-height: 220px;
        opacity: .46;
        pointer-events: none;
        transition: opacity .18s ease;
    }
    .article-progress-rail:hover,
    .article-progress-rail.is-active {
        opacity: .94;
    }
    .article-progress-node {
        width: 11px;
        height: 11px;
        pointer-events: auto;
    }
    .article-progress-node--h3 {
        width: 8px;
        height: 8px;
    }
    .article-progress-node-label { display: none; }
}
@media (max-width: 768px) {
    .top-bar-inner {
        display: flex; justify-content: space-between;
    }
    .top-bar-center { display: none; }
    .menu-toggle { display: flex; }
    .top-bar-search { display: none; }
    .top-bar-write-btn { display: none; }
    .top-bar-username { display: none; }

    .site-layout { grid-template-columns: 1fr; }

    .sidebar-nav {
        position: fixed; top: var(--header-h); left: 0; bottom: 0;
        width: 280px; z-index: 1001; border-right: 1px solid var(--border);
        transform: translateX(-100%); transition: transform .25s ease;
    }
    .sidebar-nav.open { transform: translateX(0); }

    body.admin-bar .sidebar-nav { top: calc(var(--header-h) + 46px); }
    body.admin-bar .mobile-user-drawer { top: calc(var(--header-h) + 46px); }

    .main-feed { padding: 12px; }
    .single-article { padding: 20px; }
    .single-title { font-size: 22px; }
    .post-nav { grid-template-columns: 1fr; }
    .article-progress-rail {
        right: 4px;
        width: 16px;
        height: calc(100vh - var(--header-h) - 112px);
    }
}
@media (max-width: 480px) {
    .post-card { padding: 16px; }
    .post-card-title { font-size: 16px; }
    .entry-content { font-size: 15px; }
}

/* ========== Loading Component ========== */
.loading-overlay {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.8); z-index: 100;
    border-radius: inherit; opacity: 0; visibility: hidden;
    transition: opacity .2s, visibility .2s;
}
.loading-overlay.active { opacity: 1; visibility: visible; }
.loading-overlay.fullscreen { position: fixed; border-radius: 0; z-index: 9999; }
.loading-spinner {
    width: 32px; height: 32px;
    border: 3px solid #e0e0e0; border-top-color: var(--accent);
    border-radius: 50%; animation: spin .6s linear infinite;
}
.loading-overlay.fullscreen .loading-spinner { width: 40px; height: 40px; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== Message Component ========== */
.message-toast-wrap {
    position: fixed; top: 20px; right: 20px; z-index: 10000;
    display: flex; flex-direction: column; gap: 10px;
    width: min(360px, calc(100vw - 40px)); pointer-events: none;
}
.message-toast {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 14px 16px; background: #fff;
    border: 1px solid #e5e7eb; border-left: 4px solid var(--accent);
    border-radius: 10px; box-shadow: 0 10px 30px rgba(15,23,42,.16);
    opacity: 0; transform: translateX(24px); visibility: hidden;
    transition: opacity .2s, transform .2s, visibility .2s; pointer-events: auto;
}
.message-toast.active { opacity: 1; transform: translateX(0); visibility: visible; }
.message-toast.success { border-left-color: #16a34a; }
.message-toast.error { border-left-color: #dc2626; }
.message-toast.warning { border-left-color: #f59e0b; }
.message-toast.info { border-left-color: var(--accent); }
.message-icon { flex: 0 0 auto; font-size: 20px; line-height: 1.2; }
.message-content { min-width: 0; flex: 1; }
.message-title { margin-bottom: 3px; font-size: 14px; font-weight: 700; color: #111827; }
.message-text { font-size: 13px; line-height: 1.5; color: #4b5563; word-break: break-word; }

.message-modal-overlay {
    position: fixed; inset: 0; z-index: 10001;
    display: flex; align-items: center; justify-content: center; padding: 20px;
    background: rgba(15,23,42,.42); opacity: 0; visibility: hidden;
    transition: opacity .2s, visibility .2s;
}
.message-modal-overlay.active { opacity: 1; visibility: visible; }
.message-modal {
    position: relative; width: min(420px, 100%); padding: 24px;
    background: #fff; border-radius: 14px;
    box-shadow: 0 24px 60px rgba(15,23,42,.28);
    transform: translateY(12px) scale(.98); transition: transform .2s;
}
.message-modal-overlay.active .message-modal { transform: translateY(0) scale(1); }
.message-modal-close {
    position: absolute; top: 10px; right: 12px;
    width: 30px; height: 30px; border: none; border-radius: 50%;
    background: transparent; color: #6b7280; font-size: 22px; line-height: 1;
}
.message-modal-close:hover { background: #f3f4f6; color: #111827; }
.message-modal-header { display: flex; align-items: center; gap: 10px; padding-right: 28px; }
.message-modal-title { font-size: 18px; font-weight: 700; color: #111827; }
.message-modal-body { margin-top: 14px; font-size: 14px; line-height: 1.7; color: #4b5563; }
.message-modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.message-btn {
    min-width: 84px; padding: 9px 16px; border: 1px solid #d1d5db;
    border-radius: 8px; font-size: 14px; font-weight: 600;
}
.message-btn-cancel { background: #fff; color: #374151; }
.message-btn-cancel:hover { background: #f9fafb; }
.message-btn-ok { border-color: var(--accent); background: var(--accent); color: #fff; }
.message-btn-ok:hover { background: var(--accent-hover); }

@media (max-width: 480px) {
    .message-toast-wrap { top: 12px; right: 12px; width: calc(100vw - 24px); }
    .message-modal { padding: 22px 18px 18px; }
}

/* ===== Image Viewer ===== */
.image-viewer-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(0,0,0,.92); display: none;
    align-items: center; justify-content: center;
}
.image-viewer-overlay.active { display: flex; }
.image-viewer-wrap {
    display: flex; align-items: center; justify-content: center;
    max-width: 90vw; max-height: 90vh; overflow: hidden;
}
.image-viewer-wrap img {
    max-width: 90vw; max-height: 90vh;
    object-fit: contain; border-radius: 4px;
    box-shadow: 0 4px 40px rgba(0,0,0,.5);
    user-select: none; -webkit-user-select: none;
}
.image-viewer-close {
    position: fixed; top: 16px; right: 20px;
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(255,255,255,.15); border: none;
    color: #fff; font-size: 28px; cursor: pointer;
    z-index: 10001; line-height: 40px; text-align: center;
    transition: background .2s; padding: 0;
}
.image-viewer-close:hover { background: rgba(255,255,255,.3); }
.image-viewer-prev, .image-viewer-next {
    position: fixed; top: 50%; transform: translateY(-50%);
    width: 48px; height: 48px; border-radius: 50%;
    background: rgba(255,255,255,.15); border: none;
    color: #fff; font-size: 28px; cursor: pointer;
    z-index: 10001; transition: background .2s; line-height: 48px; text-align: center; padding: 0;
    user-select: none; -webkit-user-select: none;
}
.image-viewer-prev { left: 20px; }
.image-viewer-next { right: 20px; }
.image-viewer-prev:hover, .image-viewer-next:hover { background: rgba(255,255,255,.3); }
.image-viewer-counter {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    color: rgba(255,255,255,.6); font-size: 14px; z-index: 10001;
    user-select: none;
}
.entry-content img,
.write-content-area img { cursor: zoom-in; }

/* Back to top */
.theme-toggle {
    position: fixed; bottom: 74px; right: 24px; z-index: 999;
    width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border);
    background: var(--bg-card); color: var(--text-secondary); font-size: 18px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background .15s, box-shadow .2s;
    box-shadow: var(--shadow);
}
.theme-toggle:hover { background: var(--black-indigo); box-shadow: var(--shadow-hover); }

.back-to-top {
    position: fixed; bottom: 24px; right: 24px; z-index: 999;
    width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border);
    background: var(--bg-card); color: var(--text-secondary); font-size: 18px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; opacity: 0; visibility: hidden;
    transition: opacity .25s, visibility .25s, background .15s, box-shadow .2s;
    box-shadow: var(--shadow);
}
.back-to-top.visible { opacity: 1; visibility: visible; }
.back-to-top:hover { background: var(--black-indigo); color: #fff; border-color: var(--black-indigo); box-shadow: var(--shadow-hover); }

/* ===== 阅读量 ===== */
.single-view-count { font-size: 13px; color: var(--text-muted); }

/* ===== 热门排行 — 侧边栏 ===== */
.sidebar-post-views { flex-shrink: 0; font-size: 12px; color: var(--text-muted); }
.sidebar-hot-rank-1 { color: #e8372a; }
.sidebar-hot-rank-2 { color: #e8841a; }
.sidebar-hot-rank-3 { color: #c5a200; }

/* ===== 相关文章推荐 ===== */
.related-posts {
    background: var(--bg-card); border-radius: var(--radius);
    padding: 20px 24px; margin-top: 20px;
    box-shadow: var(--shadow); margin-bottom: 1rem;
    border: 1px solid var(--border);
}
.related-posts-title {
    font-size: 15px; font-weight: 700; color: var(--text);
    margin: 0 0 12px; padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.related-posts-grid {
    display: flex; flex-direction: column; gap: 0;
}
.related-post-item {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 10px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text); transition: color .12s;
}
.related-post-item:last-child { border-bottom: none; padding-bottom: 0; }
.related-post-item:first-child { padding-top: 0; }
.related-post-item:hover { color: var(--accent); }
.related-post-info { flex: 1; min-width: 0; }
.related-post-title {
    font-size: 14px; font-weight: 500; line-height: 1.45;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.related-post-meta {
    display: flex; gap: 10px; margin-top: 3px;
    font-size: 12px; color: var(--text-muted);
}

/* ===== IP 封禁管理页面 ===== */
.ipban-page { max-width: 900px; margin: 0 auto; padding: 24px 0 40px; }

.ipban-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 10px; margin-bottom: 20px;
}
.ipban-title { font-size: 20px; font-weight: 700; color: var(--text); }
.ipban-header-actions { display: flex; gap: 8px; }

/* 统计卡片 */
.ipban-stats-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px;
}
.ipban-stat-card {
    background: var(--bg-card); border-radius: var(--radius-sm);
    border: 1px solid var(--border); padding: 14px 16px;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.ipban-stat-val   { font-size: 22px; font-weight: 700; color: var(--accent); }
.ipban-stat-label { font-size: 12px; color: var(--text-muted); }

/* 标签页 */
.ipban-tabs {
    display: flex; border-bottom: 1px solid var(--border); margin-bottom: 16px;
}
.ipban-tab {
    padding: 8px 20px; background: none; border: none; border-bottom: 2px solid transparent;
    font-size: 14px; color: var(--text-secondary); cursor: pointer;
    transition: color .12s, border-color .12s; font-weight: 500;
}
.ipban-tab:hover  { color: var(--text); }
.ipban-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* 工具栏 */
.ipban-toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.ipban-search  {
    flex: 1; min-width: 180px; padding: 8px 12px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg); font-size: 13px; color: var(--text); outline: none;
}
.ipban-search:focus { border-color: var(--accent); }

/* 按钮 */
.ipban-btn {
    padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border);
    font-size: 13px; font-weight: 500; cursor: pointer; transition: background .12s, opacity .12s;
    white-space: nowrap;
}
.ipban-btn:disabled { opacity: .55; cursor: not-allowed; }
.ipban-btn-outline  { background: var(--bg); color: var(--text-secondary); }
.ipban-btn-outline:hover  { background: var(--bg-hover); }
.ipban-btn-primary  { background: var(--accent); color: #fff; border-color: var(--accent); }
.ipban-btn-primary:hover  { opacity: .88; }
.ipban-btn-danger   { background: #e53935; color: #fff; border-color: #e53935; }
.ipban-btn-danger:hover   { opacity: .88; }

/* 表格 */
.ipban-table-wrap { overflow-x: auto; }
.ipban-table {
    width: 100%; border-collapse: collapse; font-size: 13px;
}
.ipban-table th {
    text-align: left; padding: 9px 12px; font-weight: 600; font-size: 12px;
    color: var(--text-muted); border-bottom: 1px solid var(--border);
    background: var(--bg);
}
.ipban-table td {
    padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--text);
    vertical-align: middle;
}
.ipban-table tr:last-child td { border-bottom: none; }
.ipban-table tr:hover td { background: var(--bg-hover); }
.ipban-mono   { font-family: var(--font-mono); font-size: 13px; }
.ipban-loading, .ipban-empty { text-align: center; color: var(--text-muted); padding: 20px; }

/* 行操作按钮 */
.ipban-row-btn {
    padding: 3px 10px; font-size: 12px; border-radius: 4px;
    border: 1px solid var(--border); background: var(--bg);
    color: var(--text-secondary); cursor: pointer; transition: background .1s;
}
.ipban-row-btn:hover { background: var(--bg-hover); color: var(--text); }
.ipban-row-unban:hover { border-color: #e53935; color: #e53935; }
.ipban-row-rm-wl:hover { border-color: #e53935; color: #e53935; }

/* 状态徽章 */
.ipban-badge {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    font-size: 11px; font-weight: 500;
}
.ipban-badge-perm { background: #fce4ec; color: #c62828; }
.ipban-badge-temp { background: var(--accent-light); color: var(--accent); }
.ipban-badge-exp  { background: var(--bg-hover); color: var(--text-muted); }

/* 手动封禁表单 */
.ipban-manual-form { max-width: 420px; }
.ipban-form-row    { margin-bottom: 14px; }
.ipban-form-label  { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--text); }
.ipban-required    { color: #e53935; }
.ipban-form-input  {
    width: 100%; padding: 8px 12px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--bg); font-size: 13px;
    color: var(--text); outline: none; transition: border-color .15s;
}
.ipban-form-input:focus { border-color: var(--accent); }
.ipban-form-input-sm { max-width: 120px; }
.ipban-quick-hours { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.ipban-quick-btn {
    padding: 4px 10px; font-size: 12px; border-radius: 4px;
    border: 1px solid var(--border); background: var(--bg);
    color: var(--text-secondary); cursor: pointer; transition: background .1s;
}
.ipban-quick-btn:hover { background: var(--bg-hover); border-color: var(--accent); color: var(--accent); }

/* 消息提示 */
.ipban-msg {
    margin-top: 14px; padding: 10px 14px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500;
}
.ipban-msg-ok    { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.ipban-msg-error { background: #fce4ec; color: #c62828; border: 1px solid #ef9a9a; }

/* 分页 */
.ipban-pagination {
    display: flex; align-items: center; justify-content: center;
    gap: 4px; margin-top: 14px; flex-wrap: wrap;
}
.ipban-page-info { font-size: 12px; color: var(--text-muted); margin-right: 8px; }
.ipban-page-btn {
    min-width: 30px; height: 30px; padding: 0 6px;
    border: 1px solid var(--border); border-radius: 4px;
    background: var(--bg); color: var(--text-secondary);
    font-size: 13px; cursor: pointer; transition: background .1s, border-color .1s;
    display: inline-flex; align-items: center; justify-content: center;
}
.ipban-page-btn:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--accent); color: var(--accent); }
.ipban-page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.ipban-page-btn:disabled { opacity: .4; cursor: not-allowed; }
.ipban-page-dots { font-size: 13px; color: var(--text-muted); padding: 0 2px; }

@media (max-width: 600px) {
    .ipban-stats-grid { grid-template-columns: 1fr 1fr; }
    .ipban-stats-grid .ipban-stat-card:last-child { grid-column: span 2; }
    .ipban-header { flex-direction: column; align-items: flex-start; }
}

/* ===== 评论管理页面 ===== */
.cm-main { flex: 1; padding: 24px 20px; min-height: 80vh; }
.cm-container { max-width: 860px; margin: 0 auto; }
.cm-page-header { margin-bottom: 20px; }
.cm-title { font-size: 20px; font-weight: 700; color: var(--text); }

.cm-tabs {
    display: flex; gap: 0; margin-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.cm-tab-btn {
    padding: 9px 22px; border: none; background: none; cursor: pointer;
    font-size: 14px; font-weight: 500; color: var(--text-secondary);
    border-bottom: 2px solid transparent; margin-bottom: -1px;
    transition: color .15s, border-color .15s;
}
.cm-tab-btn.active { color: var(--accent); border-color: var(--accent); }
.cm-tab-btn:hover:not(.active) { color: var(--text); }

.cm-tab-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }

.cm-list { display: flex; flex-direction: column; gap: 10px; min-height: 80px; }
.cm-loading, .cm-empty {
    text-align: center; padding: 48px 20px; color: var(--text-muted); font-size: 14px;
}

.cm-item {
    background: var(--bg-card); border-radius: var(--radius);
    padding: 16px 20px; border: 1px solid var(--border);
    box-shadow: var(--shadow); transition: box-shadow .15s, opacity .2s;
}
.cm-item:hover { box-shadow: var(--shadow-hover); }
.cm-item-deleting { opacity: .45; pointer-events: none; }

.cm-item-header {
    display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap; margin-bottom: 5px;
}
.cm-item-author { font-size: 14px; font-weight: 600; color: var(--text); }
.cm-item-date { font-size: 12px; color: var(--text-muted); margin-left: auto; }

.cm-badge { padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.cm-badge-hold { background: #fff3cd; color: #856404; }

.cm-item-post { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.cm-post-link { color: var(--accent); }
.cm-post-link:hover { color: var(--accent-hover); text-decoration: underline; }
.cm-post-text { color: var(--text-muted); }

.cm-item-content {
    font-size: 14px; color: var(--text-secondary); line-height: 1.6;
    margin-bottom: 12px; word-break: break-word;
}
.cm-item-actions { display: flex; align-items: center; gap: 8px; }

.cm-btn {
    display: inline-block; font-size: 12px; padding: 4px 14px;
    border-radius: 4px; cursor: pointer; transition: background .12s, color .12s;
    border: 1px solid; text-decoration: none; background: none;
}
.cm-btn-view { color: var(--accent); border-color: var(--accent); }
.cm-btn-view:hover { background: var(--accent-light); color: var(--accent); }
.cm-btn-delete { color: #d93025; border-color: #d93025; }
.cm-btn-delete:hover { background: #fce8e6; }
.cm-btn-approve { color: #1e7e34; border-color: #1e7e34; }
.cm-btn-approve:hover { background: #e6f4ea; }
.cm-btn-reject { color: #e67c00; border-color: #e67c00; }
.cm-btn-reject:hover { background: #fff3e0; }
.cm-tab-pending { color: #856404; }
.cm-tab-pending.active { color: #856404; border-bottom-color: #e67c00; }
.cm-item-pending { border-left: 3px solid #e67c00; }

.cm-more-wrap { text-align: center; padding: 20px 0 4px; }
.cm-btn-more {
    padding: 8px 36px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 14px; color: var(--text-secondary);
    cursor: pointer; transition: background .12s;
}
.cm-btn-more:hover { background: var(--bg-hover); }

@media (max-width: 640px) {
    .cm-main { padding: 16px 12px; }
    .cm-item { padding: 14px 14px; }
    .cm-item-date { font-size: 11px; }
}
.profile-avatar-placeholder{position: absolute;left: 36%;top: 30%;}

/* ========== Notification Badge ========== */
.notif-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 4px;
    background: #e53e3e; color: #fff;
    border-radius: 10px; font-size: 11px; font-weight: 700;
    line-height: 1; margin-left: 2px;
}
.notif-badge-menu {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 16px; height: 16px; padding: 0 4px;
    background: #e53e3e; color: #fff;
    border-radius: 10px; font-size: 10px; font-weight: 700;
    line-height: 1; margin-left: auto;
}
.user-dropdown-item { justify-content: flex-start; }

/* ========== Notification Center Page ========== */
.notif-main { padding: 32px 16px; min-width: 100%; margin: 0 auto; }
.notif-container { display: flex; flex-direction: column; gap: 16px; }
.notif-page-header { display: flex; align-items: center; justify-content: space-between; }
.notif-title { font-size: 22px; font-weight: 700; }
.notif-mark-all-btn {
    padding: 6px 14px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 13px; cursor: pointer; background: #fff; color: var(--text-secondary);
    transition: background .12s;
}
.notif-mark-all-btn:hover { background: var(--bg-hover); }

.notif-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.notif-tab-btn {
    padding: 8px 16px; font-size: 14px; border: none; background: none;
    cursor: pointer; color: var(--text-secondary); border-bottom: 2px solid transparent;
    margin-bottom: -1px; transition: color .15s, border-color .15s;
}
.notif-tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.notif-tab-btn:hover { color: var(--text); }

.notif-list { display: flex; flex-direction: column; gap: 2px; }
.notif-loading, .notif-empty { text-align: center; padding: 32px; color: var(--text-muted); font-size: 14px; }

.notif-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 16px; border-radius: 8px; cursor: pointer;
    transition: background .12s; position: relative;
}
.notif-item:hover { background: var(--bg-hover); }
.notif-unread { background: #f0f7ff; }
.notif-unread:hover { background: #e4f0fc; }
.notif-read { background: #fff; }

.notif-item-icon { font-size: 22px; flex-shrink: 0; margin-top: 2px; }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title { font-size: 14px; font-weight: 600; color: var(--text); }
.notif-unread .notif-item-title { font-weight: 700; }
.notif-item-content { font-size: 13px; color: var(--text-secondary); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-item-time { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.notif-dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
    flex-shrink: 0; margin-top: 6px;
}

.notif-more-wrap { text-align: center; padding: 8px 0; }
.notif-btn-more {
    padding: 8px 24px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 13px; cursor: pointer; background: #fff; color: var(--text-secondary);
    transition: background .12s;
}
.notif-btn-more:hover { background: var(--bg-hover); }

@media (max-width: 640px) {
    .notif-main { padding: 16px 12px; }
    .notif-item { padding: 12px 12px; }
}

/* ===== Mobile User Drawer ===== */
.mobile-user-drawer {
    position: fixed; top: var(--header-h); right: 0; bottom: 0;
    width: min(280px, calc(100vw - 40px)); background: var(--bg-card); z-index: 1002;
    transform: translateX(110%); transition: transform .28s cubic-bezier(.4,0,.2,1);
    display: flex; flex-direction: column;
    box-shadow: -4px 0 28px rgba(0,0,0,.18);
}
body.admin-bar .mobile-user-drawer { top: calc(var(--header-h) + 32px); }
.mobile-user-drawer.open { transform: translateX(0); }

.mud-hdr {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 14px 14px; border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.mud-user-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.mud-avatar { flex-shrink: 0; }
.mud-avatar img, .mud-avatar .avatar-placeholder { width: 48px; height: 48px; border-radius: 50%; }
.mud-user-text { display: flex; flex-direction: column; min-width: 0; }
.mud-username { font-size: 15px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mud-email    { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mud-close {
    flex-shrink: 0; background: none; border: none; line-height: 1;
    font-size: 18px; color: var(--text-muted); cursor: pointer;
    padding: 6px; border-radius: 6px; transition: background .15s;
}
.mud-close:hover { background: var(--bg-hover); }

.mud-nav { flex: 1; overflow-y: auto; padding: 8px 8px 32px; }
.mud-nav::-webkit-scrollbar { width: 3px; }
.mud-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.mud-item {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 10px; font-size: 15px; color: var(--text);
    border-radius: 8px; text-decoration: none; transition: background .12s;
}
.mud-item:hover { background: var(--bg-hover); }
.mud-icon { width: 24px; text-align: center; font-size: 18px; flex-shrink: 0; }
.mud-logout { color: var(--text-muted); }
.mud-divider { height: 1px; background: var(--border); margin: 4px 0; }
.notif-badge-mud {
    margin-left: auto; background: var(--accent); color: #fff;
    font-size: 11px; font-weight: 700; border-radius: 10px;
    padding: 1px 6px; min-width: 18px; text-align: center;
}
.mb-0 { margin-bottom: 0 !important; }

.feed-header + .books-cats {
    margin-top: -4px;
}

.books-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
}

.books-cats a {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    background: var(--bg-card);
}

.books-cats a:hover,
.books-cats a.active {
    border-color: var(--accent);
    color: var(--accent);
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 18px;
}

.book-card {
    display: grid;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
}

.book-card.disabled {
    opacity: .6;
    pointer-events: none;
}

.book-cover {
    aspect-ratio: 3 / 4;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card, #fff);
    color: var(--text-muted);
    font-weight: 700;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .18s ease;
}

.book-card:hover .book-cover img {
    transform: scale(1.03);
}

.book-info h2 {
    margin: 0;
    font-size: 15px;
    line-height: 1.35;
    color: var(--text);
}

.book-info p {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.55;
}

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

.books-pagination {
    margin-top: 28px;
}

/* dark mode overrides are inherited via CSS vars — no extra rules needed */
