* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

:root {
    --bg-color: #ffffff;
    --text-color: #222;
    --card-bg: #f8f9fa;
    --accent: #2563eb;
    --border-color: #e5e7eb;
    --tag-bg: #eef4ff;
    --tag-color: #2563eb;
}

.dark-mode {
    --bg-color: #111827;
    --text-color: #e5e7eb;
    --card-bg: #1f2937;
    --accent: #60a5fa;
    --border-color: #374151;
    --tag-bg: #273444;
    --tag-color: #93c5fd;
}
/* ===== 全屏背景图（深浅色不同壁纸） ===== */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: url("pic/day.jpg") center/cover no-repeat;
    z-index: -1;
}

body.dark-mode::before {
    background: url("pic/night.jpg") center/cover no-repeat;
}

/* ===== 背景遮罩（确保文字清晰，同时更透明） ===== */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.3); /* 浅色模式：白色半透明 */
}

body.dark-mode::after {
    background: rgba(0, 0, 0, 0.4); /* 深色模式：黑色半透明 */
}

/* 保证内容在背景之上 */
body {
    position: relative;
}

body {
    font-family: system-ui, -apple-system, "Microsoft YaHei", sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    transition: 0.3s ease;
    line-height: 1.8;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 导航栏 */
.navbar {
    position: fixed;
    width: 100%;
    top: 0;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    z-index: 999;
}
.nav-wrap {
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.blog-logo {
    font-size: 22px;
    font-weight: bold;
    color: var(--accent);
    text-decoration: none;
}
.nav-menu a {
    color: var(--text-color);
    text-decoration: none;
    margin-left: 20px;
}
.nav-menu a:hover {
    color: var(--accent);
}
#themeBtn {
    margin-left: 20px;
    padding: 5px 12px;
    border: 1px solid var(--accent);
    background: transparent;
    color: var(--accent);
    border-radius: 6px;
    cursor: pointer;
}

/* 横幅 */
.banner {
    margin-top: 64px;
    height: 260px;
    background: url("pic/banner.jpg") center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #fff;
}

body.dark-mode .banner {
    background: url("pic/banner-dark.jpg") center/cover no-repeat;
}

.banner-content h1 {
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    font-size: 34px;
    margin-bottom: 10px;
}

/* 搜索框 */
.search-box {
    margin: 40px 0;
}
.search-box input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 15px;
}

/* 标签 */
.tag-section {
    margin: 40px 0;
}
.tag-section h2 {
    margin-bottom: 20px;
    border-left: 4px solid var(--accent);
    padding-left: 12px;
}
.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.tag-item {
    padding: 6px 14px;
    background: var(--tag-bg);
    color: var(--tag-color);
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: 0.2s;
}
.tag-item:hover {
    background: var(--accent);
    color: #fff;
}
.tag-item.active {
    background: var(--accent);
    color: #fff;
}

/* 文章列表 */
.article-section h2 {
    margin-bottom: 20px;
    border-left: 4px solid var(--accent);
    padding-left: 12px;
}
.article-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 20px;
    transition: 0.2s;
}
.article-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px #00000012;
}
.article-item h3 a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 20px;
}
.article-item h3 a:hover {
    color: var(--accent);
}
.article-meta {
    font-size: 14px;
    opacity: 0.8;
    margin: 10px 0;
    display: flex;
    gap: 16px;
}
.article-desc {
    color: var(--text-color);
    opacity: 0.9;
}

/* 分页 */
.page-box {
    display: flex;
    gap: 8px;
    margin: 40px 0;
    justify-content: center;
}
.page-item {
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
}
.page-item.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* 文章详情页 */
.article-detail-wrap {
    margin-top: 80px;
    margin-bottom: 60px;
}
.article-detail h1 {
    font-size: 30px;
    margin-bottom: 15px;
}
.detail-meta {
    font-size: 14px;
    opacity: 0.8;
    margin-bottom: 20px;
    display: flex;
    gap: 20px;
}
.md-body {
    margin-top: 30px;
}
.md-body h2 {
    margin: 24px 0 12px;
}
.md-body h3 {
    margin: 20px 0 10px;
}
.md-body p {
    margin: 12px 0;
}
.md-body pre {
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    background: var(--card-bg);
    margin: 16px 0;
}
.md-body code {
    font-family: consolas;
}
.md-body ul, .md-body ol {
    padding-left: 24px;
    margin: 12px 0;
}

/* 关于我 */
.about-section {
    margin: 80px 0;
}
.about-section h2 {
    margin-bottom: 20px;
    border-left: 4px solid var(--accent);
    padding-left: 12px;
}
.about-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 26px;
    border-radius: 10px;
}

/* 回到顶部 */
.back-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}
.back-top.show {
    opacity: 1;
    visibility: visible;
}

.footer {
    text-align: center;
    padding: 30px;
    border-top: 1px solid var(--border-color);
    font-size: 14px;
    opacity: 0.8;
}

/* 适配手机 */
@media (max-width:640px) {
    .banner-content h1 {
        font-size: 24px;
    }
    .nav-menu a {
        margin-left: 8px;
        font-size: 14px;
    }
}
/* ===== 密码弹窗样式 ===== */
.password-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
}
.password-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    width: 300px;
}
.password-card h2 {
    margin-bottom: 20px;
    color: var(--text-color);
}
.password-card input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 16px;
    margin-bottom: 16px;
    box-sizing: border-box;
}
.password-card button {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: 0.2s;
}
.password-card button:hover {
    opacity: 0.85;
}
#passwordError {
    color: #ef4444;
    margin: 10px 0 0;
    font-size: 14px;
}

/* ===== 视频网页内全屏 ===== */
.video-wrapper {
    position: relative;
    margin: 16px 0;
}

.video-fullscreen-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s;
}
.video-fullscreen-btn:hover {
    background: var(--accent);
}

/* 全屏遮罩层 */
.video-fullscreen-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.video-fullscreen-overlay video,
.video-fullscreen-overlay iframe {
    max-width: 90vw;
    max-height: 90vh;
    width: 90%;
    height: 90%;
    border-radius: 8px;
}
.video-fullscreen-close {
    position: fixed;
    top: 20px;
    right: 30px;
    z-index: 100000;
    background: none;
    color: #fff;
    font-size: 40px;
    border: none;
    cursor: pointer;
    opacity: 0.7;
}
.video-fullscreen-close:hover {
    opacity: 1;
}

.md-body video,
.md-body iframe {
    display: block;          /* 块级元素，方便设置边距 */
    max-width: 80%;          /* 最大宽度为容器的80% */
    height: auto;            /* 高度自动保持比例 */
    margin: 20px auto;       /* 上下间距20px，左右自动居中 */
    border-radius: 8px;
}

.footer:hover .admin-link {
    opacity: 1 !important;
}
