:root { 
    --primary: #2563eb; 
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --bg: #f8fafc; 
    --card-bg: #ffffff; 
    --text: #0f172a; 
    --text-secondary: #4b5563;
    --text-muted: #94a3b8;
    --border: #f1f5f9;
    --border-hover: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.08);
    --radius: 16px;
}

*, *::before, *::after { 
    box-sizing: border-box; 
}

html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif; 
    background-color: var(--bg); 
    color: var(--text); 
    margin: 0; 
    padding: 0; 
    line-height: 1.7; 
    -webkit-tap-highlight-color: transparent;
    overflow-wrap: anywhere;
    word-break: break-word;
}

img, svg, video { 
    max-width: 100%; 
    height: auto; 
    display: block; 
}

.post-excerpt, .post-title, .meta, .widget-list a, p, span {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Header & Navigation */
header { 
    background: rgba(255, 255, 255, 0.95); 
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-hover);
    padding: 10px 0; 
    position: sticky; 
    top: 0; 
    z-index: 100; 
    width: 100%;
}

.header-content { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 0 16px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    position: relative;
    min-height: 64px;
}

.brand-logo { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    text-decoration: none; 
    min-height: 64px; 
    flex-shrink: 0; 
    position: relative;
    z-index: 1;
}

.brand-logo img { 
    height: 48px; 
    width: auto;  
    max-width: 180px;
    object-fit: contain; 
    margin-right: 14px; 
    pointer-events: auto;
}

.site-title { 
    margin: 0; 
    font-size: 1.2rem; 
    font-weight: 700; 
    color: var(--text); 
    letter-spacing: -0.5px; 
    white-space: nowrap; 
}

.menu-toggle { 
    display: none; 
    background: none; 
    border: none; 
    font-size: 1.6rem; 
    cursor: pointer; 
    color: var(--text); 
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 101;
    touch-action: manipulation;
    margin-left: auto;
}

.nav-links { 
    display: flex; 
    gap: 6px; 
    align-items: center; 
    list-style: none; 
    margin: 0; 
    padding: 0; 
}

/* PC端菜单栏：加入背景底色与细边框，增强辨识度 */
.nav-links li a { 
    color: var(--text-secondary); 
    text-decoration: none; 
    font-size: 0.92rem; 
    font-weight: 500; 
    transition: all 0.2s ease-in-out; 
    padding: 6px 14px; 
    border-radius: 20px; 
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    white-space: nowrap;
    cursor: pointer;
    letter-spacing: 0.2px;
    background-color: #f1f5f9; /* 加上默认背景底色 */
    border: 1px solid #e2e8f0;   /* 加上细腻轮廓线条 */
}

.nav-links li a:hover { 
    color: var(--primary); 
    background-color: var(--primary-light); 
    border-color: rgba(37, 99, 235, 0.2);
}

.nav-links li a.active {
    color: var(--primary) !important;
    font-weight: 700 !important;
    background-color: var(--primary-light) !important; 
    border-color: rgba(37, 99, 235, 0.3) !important;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.2); 
}

/* User Nav & Buttons */
.user-nav { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    border-left: 1px solid var(--border-hover); 
    padding-left: 12px; 
    margin-left: 4px; 
    flex-shrink: 0; 
}

.btn-primary, .btn-admin {
    font-weight: 500;
    border-radius: 8px;
    padding: 8px 14px !important;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-link { 
    color: var(--primary) !important; 
    font-weight: 600 !important; 
}

/* PC端“注册”按钮：使用更深的主蓝色背景与边框，使白色文字突出 */
.btn-primary { 
    background-color: var(--primary) !important; 
    border: 1px solid #1d4ed8 !important;
    color: #ffffff !important; 
    font-weight: 600 !important;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-hover) !important;
    border-color: #1e40af !important;
}

.btn-admin { 
    background: #ef4444; 
    color: #ffffff !important; 
}

.btn-admin:hover {
    background: #dc2626;
}

/* Breadcrumbs */
.breadcrumb-container {
    max-width: 1200px;
    margin: 12px auto 0 auto;
    padding: 0 16px;
    width: 100%;
}

.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 8px 14px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.85rem;
    box-shadow: var(--shadow-sm);
}

.breadcrumb-item {
    display: inline-flex;
    align-items: center;
    color: var(--text-muted);
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "/";
    padding: 0 8px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.breadcrumb-item a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
}

.breadcrumb-item a:hover {
    color: var(--primary);
}

.breadcrumb-item.active {
    color: var(--text);
    font-weight: 600;
}

/* Layout */
.layout-container { 
    max-width: 1200px; 
    margin: 24px auto 0 auto; 
    padding: 0 16px; 
    display: grid; 
    grid-template-columns: 1fr 300px; 
    gap: 24px; 
    width: 100%;
}

main { min-width: 0; }

/* Posts */
.post-card { 
    background: var(--card-bg); 
    border-radius: var(--radius); 
    padding: 20px; 
    margin-bottom: 18px; 
    box-shadow: var(--shadow-sm); 
    border: 1px solid var(--border); 
    transition: all 0.25s ease; 
    overflow: hidden; 
}

.post-card:hover { 
    transform: translateY(-2px); 
    box-shadow: var(--shadow-md); 
    border-color: var(--border-hover);
}

.post-card-inner {
    display: flex;
    gap: 20px;
    align-items: stretch;
    width: 100%;
}

.post-thumbnail {
    flex-shrink: 0;
    width: 220px;
    height: 140px;
    border-radius: 10px;
    overflow: hidden;
    background: #f1f5f9;
    border: 1px solid var(--border);
    display: block;
}

.post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.post-body {
    flex: 1;
    min-width: 0; 
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.post-title { 
    margin: 0 0 10px 0; 
    font-size: 1.2rem; 
    font-weight: 700; 
    line-height: 1.45; 
}

.post-title a { 
    color: var(--text); 
    text-decoration: none; 
}

.post-title a:hover { color: var(--primary); }

.badge { 
    display: inline-flex; 
    align-items: center; 
    padding: 2px 6px; 
    font-size: 0.72rem; 
    border-radius: 5px; 
    font-weight: 600; 
    margin-right: 4px; 
}

.badge-top { background: #fef2f2; color: #ef4444; border: 1px solid #fee2e2; }
.badge-hot { background: #fff7ed; color: #f97316; border: 1px solid #ffedd5; }

.post-excerpt { 
    font-size: 0.92rem; 
    color: var(--text-secondary); 
    margin-bottom: 14px; 
    line-height: 1.7; 
    display: -webkit-box; 
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical; 
    overflow: hidden; 
}

.post-footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px dashed var(--border);
    padding-top: 12px;
    margin-top: 6px;
    gap: 10px;
    flex-wrap: wrap;
}

.meta { 
    font-size: 0.82rem; 
    color: var(--text-muted); 
    display: flex; 
    gap: 10px; 
    align-items: center; 
    flex-wrap: wrap;
}

.read-more-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    background: var(--primary-light);
    padding: 7px 16px;
    border-radius: 18px;
}

.load-more-container { text-align: center; margin: 24px 0 40px 0; }

.btn-load-more {
    background: #ffffff;
    color: var(--text);
    border: 1px solid var(--border-hover);
    padding: 10px 32px;
    min-height: 44px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 28px;
    cursor: pointer;
}

/* Sidebar */
.sidebar { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.widget { 
    background: var(--card-bg); 
    border-radius: var(--radius); 
    padding: 18px; 
    box-shadow: var(--shadow-sm); 
    border: 1px solid var(--border); 
}

.widget-title { 
    font-size: 0.98rem; 
    font-weight: 700; 
    margin: 0 0 12px 0; 
    padding-bottom: 10px; 
    border-bottom: 1px solid var(--border); 
}

.widget-list { list-style: none; padding: 0; margin: 0; }

.widget-list li { margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.widget-list a { 
    color: var(--text-secondary); 
    text-decoration: none; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    white-space: nowrap; 
    flex: 1; 
    min-width: 0;
}

.rank-num { 
    display: inline-flex; justify-content: center; align-items: center; 
    width: 20px; height: 20px; border-radius: 5px; background: #f1f5f9; font-size: 0.72rem; 
    flex-shrink: 0;
}

.rank-num.top-1 { background: #ef4444; color: #fff; }
.rank-num.top-2 { background: #f97316; color: #fff; }
.rank-num.top-3 { background: #eab308; color: #fff; }

/* Footer */
footer { 
    background: var(--card-bg); 
    border-top: 1px solid var(--border); 
    padding: 28px 16px; 
    text-align: center; 
    font-size: 0.85rem; 
    margin-top: 30px;
}

.stats-bar { 
    display: inline-flex; 
    flex-wrap: wrap; 
    justify-content: center; 
    gap: 10px 16px; 
    background: #f8fafc; 
    padding: 10px 16px; 
    border-radius: 24px; 
    border: 1px solid var(--border); 
    max-width: 100%;
}

/* Responsive Media Queries */
@media screen and (max-width: 1024px) {
    .layout-container { 
        grid-template-columns: 1fr 260px; 
        gap: 16px; 
    }
    .post-thumbnail { 
        width: 180px; 
        height: 120px; 
    }
}

@media screen and (max-width: 868px) {
    .layout-container { 
        grid-template-columns: 1fr; 
        gap: 20px; 
    }
    
    .menu-toggle { 
        display: inline-flex; 
    }

    /* 移动端下拉菜单：适度收紧整体尺寸 */
    .nav-links { 
        display: none; 
        position: absolute;
        top: calc(100% + 6px); 
        right: 16px; 
        left: auto;
        width: max-content;
        min-width: 170px;
        max-width: calc(100vw - 32px);
        background: #ffffff; 
        flex-direction: column; 
        gap: 6px;
        padding: 8px; 
        border: 1px solid var(--border-hover);
        border-radius: 12px;
        box-shadow: var(--shadow-lg);
        z-index: 102;
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
        transition: opacity 0.2s ease, transform 0.2s ease;
    }

    .nav-links.active { 
        display: flex; 
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    .nav-links li {
        width: 100%;
    }

    /* 移动端菜单功能链接：居中对齐、优化内部边距与文字间距 */
    .nav-links a { 
        width: 100%; 
        padding: 7px 12px; 
        border-radius: 8px;
        background: #e2e8f0; 
        border: 1px solid #cbd5e1;
        color: var(--text);
        font-weight: 600;
        font-size: 0.88rem;
        letter-spacing: 0.2px;
        justify-content: center;
        text-align: center;
        min-height: 34px;
    }

    .nav-links a:hover {
        background: var(--primary-light);
        color: var(--primary);
        border-color: var(--primary);
    }

    .nav-links a.active {
        justify-content: center;
    }

    /* 移动端底部用户导航区：文本统一居中 */
    .user-nav {
        border-left: none;
        border-top: 1px dashed var(--border-hover);
        margin-top: 2px;
        padding-top: 8px;
        padding-left: 0;
        margin-left: 0;
        gap: 6px;
        width: 100%;
        flex-direction: column;
    }

    .user-nav .btn-link {
        width: 100%;
        text-align: center;
        justify-content: center;
        background: #e2e8f0;
        border: 1px solid #cbd5e1;
        padding: 7px 12px;
        border-radius: 8px;
        min-height: 34px;
        font-size: 0.88rem;
    }

    .user-nav .btn-primary {
        width: 100%;
        justify-content: center;
        text-align: center;
        background: var(--primary) !important;
        color: #ffffff !important;
        box-shadow: var(--shadow-sm);
        min-height: 34px;
        padding: 7px 12px !important;
        font-size: 0.88rem;
    }

    .user-nav .btn-admin {
        width: 100%;
        justify-content: center;
        text-align: center;
        background: #ef4444 !important;
        color: #ffffff !important;
        box-shadow: var(--shadow-sm);
        min-height: 34px;
        padding: 7px 12px !important;
        font-size: 0.88rem;
    }

    .breadcrumb-container {
        padding: 0 12px;
        margin-top: 8px;
    }

    .breadcrumb {
        flex-wrap: nowrap;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .breadcrumb::-webkit-scrollbar {
        display: none; 
    }
}

@media screen and (max-width: 640px) {
    .header-content { padding: 0 12px; }
    .site-title { font-size: 1rem; }
    
    .layout-container { padding: 0 12px; margin-top: 16px; }

    .post-card { padding: 14px; }
    .post-card-inner { flex-direction: column; gap: 12px; }
    .post-thumbnail { width: 100% !important; aspect-ratio: 16 / 9; height: auto; }
    
    .post-title { font-size: 1.08rem; }
    .post-excerpt { font-size: 0.88rem; margin-bottom: 10px; }
    
    .post-footer-row { 
        flex-direction: column; 
        align-items: stretch; 
    }

    .read-more-link { width: 100%; text-align: center; justify-content: center; }
}

@media screen and (max-width: 480px) {
    .brand-logo img { 
        height: 36px;
        max-width: 140px;
        margin-right: 10px; 
    }
    .site-title { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .meta { font-size: 0.78rem; gap: 6px; }
    .stats-bar { font-size: 0.78rem; border-radius: 12px; }
    .breadcrumb { font-size: 0.75rem; padding: 5px 8px; }
}