*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, "Microsoft Yahei", sans-serif;
}

html {
    scroll-behavior: smooth;
}

:root{
    --bg: #f7f9fc;
    --text: #333;
    --title: #111827;
    --muted: #6b7280;
    --card: #ffffff;
    --border: #e5e7eb;
    --tag-bg: #eff6ff;
    --tag-text: #3b82f6;
    --btn-bg: #3b82f6;
    --btn-text: #ffffff;
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.08);
}

.dark{
    --bg: #121212;
    --text: #e5e5e5;
    --title: #ffffff;
    --muted: #a1a1aa;
    --card: #1e1e1e;
    --border: #2c2c2c;
    --tag-bg: #2563eb;
    --tag-text: #ffffff;
    --shadow: 0 2px 8px rgba(0,0,0,0.18);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.22);
}

body{
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    transition: background 0.3s ease, color 0.3s ease;
    padding-top: 0;
}

.container{
    width: 1280px;
    max-width: 96%;
    margin: 0 auto;
}

/* 顶部固定导航 */
header{
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 999;
}

.header-box{
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo{
    font-size: 24px;
    font-weight: 700;
    color: var(--title);
    text-decoration: none;
}
.logo img {
    height: 44px;
    width: auto;
    display: block;
}

.header-right{
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav{
    display: flex;
    gap: 26px;
    list-style: none;
}

.nav > li{
    position: relative;
}

.nav a{
    color: var(--muted);
    text-decoration: none;
    font-size: 15px;
    padding: 4px 0;
    transition: color 0.2s ease;
}

/* 导航hover蓝色点击效果 */
.nav a:hover,
.nav li.active > a{
    color: var(--btn-bg);
}

.sub-menu{
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 120px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 0;
    box-shadow: var(--shadow);
    display: none;
    z-index: 99;
}

.menu-item-has-children:hover .sub-menu{
    display: block;
}

.sub-menu li{
    padding: 0 12px;
}

.sub-menu a{
    padding: 6px 0;
    font-size: 14px;
}

.sub-menu a:hover{
    color: var(--btn-bg);
}

.mode-toggle,
.hamburger{
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    padding: 0;
    margin: 0;
    line-height: 1;
    transition: all 0.2s ease;
}

.mode-toggle:hover,
.hamburger:hover{
    color: var(--btn-bg);
    border-color: var(--btn-bg);
}

.hamburger{
    display: none;
}

/* 移动端侧边导航菜单 */
.mobile-nav{
    position: fixed;
    top: 56px;
    left: 0;
    width: 100%;
    height: calc(100vh - 56px);
    background: var(--card);
    z-index: 998;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    padding-top: 0;
}
.mobile-nav.active{
    transform: translateX(0);
}
.mobile-nav .container{
    width: 100%;
    max-width: 100%;
    padding: 0 24px;
}
.mobile-nav ul{
    list-style: none;
    padding: 0;
    margin-top: 0;
}
.mobile-nav li{
    border-bottom: 1px solid var(--border);
}
.mobile-nav a{
    font-size: 20px;
    color: var(--title);
    text-decoration: none;
    display: block;
    padding: 16px 0;
    border-bottom: none;
    transition: color 0.2s ease;
}
.mobile-nav a:hover{
    color: var(--btn-bg);
}

/* Banner */
.banner{
    background: var(--card);
    padding: 48px 0;
    text-align: center;
    margin: 24px 0 20px;
    border-radius: 12px;
}

.banner h1{
    font-size: 34px;
    color: var(--title);
    margin-bottom: 10px;
}

.banner p{
    font-size: 17px;
    color: var(--muted);
    margin-bottom: 24px;
}

.btn{
    padding: 10px 28px;
    background: var(--btn-bg);
    color: var(--btn-text);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    display: inline-block;
}

.btn:hover{
    background: #2563eb;
}

/* 分区标题 */
.section-title{
    font-size: 16px;
    margin-bottom: 20px;
    color: var(--muted);
    font-weight: 600;
    padding-left: 10px;
    border-left: 2px solid var(--btn-bg);
}

/* 首页文章双列网格 */
.article-grid{
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
    margin-bottom: 30px;
}

/* 文章卡片通用 */
.article-item{
    background: var(--card);
    border-radius: 12px;
    padding: 22px;
    display: flex;
    gap: 18px;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border);
    transition: 0.25s;
    overflow: hidden;
}

.article-item:hover{
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.book-cover{
    width: 96px;
    height: 130px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.book-cover .cover-placeholder{
    width: 100%;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e8e8e8, #d8d8d8);
    color: #999;
    font-size: 12px;
}

.dark .book-cover .cover-placeholder{
    background: linear-gradient(135deg, #2a2a2a, #1f1f1f);
}

.book-cover img{
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: relative;
    z-index: 2;
}

.article-text{
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-width: 0;
}

.article-text h3{
    font-size: 18px;
    color: var(--title);
    margin-bottom: 6px;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    transition: color 0.2s ease;
}

.article-item:hover .article-text h3 {
    color: var(--btn-bg);
}

.meta-row{
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: nowrap;
}

.tag{
    display: inline-block;
    padding: 2px 8px;
    background: var(--tag-bg);
    color: var(--tag-text);
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
}

.time{
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}

.article-text p{
    font-size: 14px;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.6;
    overflow: hidden;
    margin: 0;
}

/* 友情链接 */
.pc-only{
    display: block;
}
.link-box{
    margin: 10px 0 30px;
    padding: 24px;
    background: var(--card);
    border-radius: 12px;
    border: 1px solid var(--border);
}
.link-title{
    font-size: 16px;
    color: var(--title);
    margin-bottom: 14px;
}
.link-list{
    display: flex;
    flex-wrap: wrap;
    gap: 18px 32px;
}
.link-list a{
    color: var(--muted);
    text-decoration: none;
    font-size: 15px;
    transition: color 0.2s ease;
}
.link-list a:hover{
    color: var(--btn-bg);
}

footer{
    border-top: 1px solid var(--border);
    text-align: center;
    padding: 26px 0;
    color: var(--muted);
    font-size: 14px;
}

/* 响应式 */
@media(max-width: 1024px){
    .article-grid{
        grid-template-columns: 1fr;
    }
}
@media(max-width: 768px){
    .pc-only{
        display: none !important;
    }
    .nav{
        display: none;
    }
    .hamburger{
        display: flex;
    }
    .banner h1{
        font-size: 28px;
    }
    .article-item{
        flex-direction: row;
        padding: 16px;
    }
    .book-cover{
        width: 80px;
        height: 110px;
        flex-shrink: 0;
    }
    .article-text h3{
        font-size: 16px;
    }
    .article-text p{
        font-size: 13px;
    }
}
