/* ===== 全局重置 & 基础 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2c3e8f;
    --primary-light: #3b5a9e;
    --primary-dark: #1a2a5e;
    --secondary: #e8edf5;
    --accent: #e67e22;
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a6a;
    --text-light: #8888aa;
    --bg-body: #f5f7fb;
    --bg-white: #ffffff;
    --border-color: #e2e6ef;
    --shadow: 0 4px 20px rgba(44, 62, 143, 0.08);
    --shadow-hover: 0 8px 35px rgba(44, 62, 143, 0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Microsoft JhengHei", sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    font: 17px/1.7 var(--font-family);
    color: var(--text-primary);
    background: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent);
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
}

/* ===== 容器 ===== */
.container-custom {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== 导航栏 ===== */
.navbar-custom {
    background: var(--bg-white) !important;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.navbar-custom .navbar-brand {
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--primary) !important;
    letter-spacing: 1px;
}

.navbar-custom .navbar-brand:hover {
    color: var(--accent) !important;
}

.navbar-custom .nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    padding: 8px 16px !important;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.navbar-custom .nav-link:hover {
    color: var(--primary) !important;
    background: var(--secondary);
}

.navbar-custom .navbar-toggler {
    border: none;
    padding: 8px 12px;
}

.navbar-custom .navbar-toggler:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(44, 62, 143, 0.15);
}

/* ===== 页面头部 ===== */
.page-header {
    padding: 20px 0 16px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.page-header h1,
.page-header h5 {
    font-weight: 700;
    color: var(--text-primary);
}

.page-header h1 {
    font-size: 2rem;
}

.page-header h5 {
    font-size: 1.4rem;
}

.page-header .text-muted {
    color: var(--text-light) !important;
    font-weight: 400;
    font-size: 0.9rem;
}

/* ===== 搜索表单 ===== */
.search-form {
    background: var(--bg-white);
    padding: 24px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.search-form label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.search-form .form-control {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    font-size: 1rem;
    transition: var(--transition);
    min-width: 220px;
}

.search-form .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(44, 62, 143, 0.1);
    outline: none;
}

.search-form .btn-success {
    background: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 32px;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
}

.search-form .btn-success:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(44, 62, 143, 0.3);
}

/* ===== 内容主区域 ===== */
.main-content {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 24px 28px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

/* ===== 文章列表 ===== */
.article-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.article-list li {
    border-bottom: 1px solid var(--border-color);
    padding: 20px 0;
    transition: var(--transition);
}

.article-list li:last-child {
    border-bottom: none;
}

.article-list li:hover {
    padding-left: 12px;
}

.article-list .t {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.article-list .t a {
    color: var(--text-primary);
}

.article-list .t a:hover {
    color: var(--primary);
}

.article-list .r {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-top: 4px;
    word-break: break-word;
}

/* ===== 单篇文章 ===== */
.article-single h9 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    margin-bottom: 12px;
    line-height: 1.3;
}

.article-single p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.8;
}

.article-single .content {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.9;
}

.article-single .content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin: 16px 0;
}

/* ===== 侧边栏 ===== */
.sidebar-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 20px 0;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.sidebar-card .card-header {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 20px 12px;
    border-bottom: 2px solid var(--border-color);
    background: transparent;
}

.sidebar-card .card-body {
    padding: 12px 20px 8px;
}

.sidebar-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-card ul li {
    padding: 8px 0;
    border-bottom: 1px solid #f0f2f7;
}

.sidebar-card ul li:last-child {
    border-bottom: none;
}

.sidebar-card ul li a {
    color: var(--text-secondary);
    font-size: 0.92rem;
    transition: var(--transition);
    display: block;
}

.sidebar-card ul li a:hover {
    color: var(--primary);
    padding-left: 6px;
}

.sidebar-card ul li a .badge-hot {
    background: var(--accent);
    color: #fff;
    font-size: 0.65rem;
    padding: 1px 8px;
    border-radius: 20px;
    margin-left: 6px;
}

/* ===== 广告位 ===== */
.ad-placeholder {
    background: var(--secondary);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
    color: var(--text-light);
    font-size: 0.85rem;
    margin: 16px 0;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== 页脚 ===== */
.footer-custom {
    border-top: 1px solid var(--border-color);
    padding: 40px 0 30px;
    margin-top: 40px;
    background: var(--bg-white);
}

.footer-custom .foot {
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
}

.footer-custom .foot a {
    color: var(--text-secondary);
    padding: 0 12px;
}

.footer-custom .foot a:hover {
    color: var(--primary);
}

/* ===== 响应式设计 ===== */
@media (max-width: 992px) {
    .main-content {
        padding: 20px;
    }
    
    .page-header h1 {
        font-size: 1.6rem;
    }
    
    .article-single h9 {
        font-size: 1.5rem;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 16px;
    }
    
    .container-custom {
        padding: 0 12px;
    }
    
    .main-content {
        padding: 16px;
        border-radius: var(--radius-sm);
    }
    
    .search-form {
        padding: 16px;
    }
    
    .search-form .form-control {
        min-width: 100%;
    }
    
    .search-form .btn-success {
        width: 100%;
    }
    
    .page-header h1 {
        font-size: 1.4rem;
    }
    
    .page-header h5 {
        font-size: 1.2rem;
    }
    
    .article-list .t {
        font-size: 1rem;
        white-space: normal;
    }
    
    .article-single h9 {
        font-size: 1.3rem;
    }
    
    .sidebar-card {
        margin-top: 20px;
    }
    
    .navbar-custom .navbar-brand {
        font-size: 1.1rem;
    }
}

@media (max-width: 576px) {
    .main-content {
        padding: 12px;
    }
    
    .page-header {
        padding: 12px 0;
    }
    
    .page-header h1 {
        font-size: 1.2rem;
    }
    
    .article-list li {
        padding: 14px 0;
    }
    
    .footer-custom {
        padding: 24px 0 20px;
    }
    
    .footer-custom .foot a {
        display: inline-block;
        padding: 4px 8px;
    }
}

/* ===== SEO 优化 ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* 面包屑导航 */
.breadcrumb-custom {
    font-size: 0.85rem;
    color: var(--text-light);
    padding: 8px 0 16px;
}

.breadcrumb-custom a {
    color: var(--text-secondary);
}

.breadcrumb-custom a:hover {
    color: var(--primary);
}

/* 文章元信息 */
.article-meta {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.article-meta span {
    margin-right: 16px;
}

/* 加载动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeInUp 0.5s ease forwards;
}

/* 打印样式 */
@media print {
    .navbar-custom,
    .search-form,
    .sidebar-card,
    .ad-placeholder,
    .footer-custom {
        display: none !important;
    }
    
    .main-content {
        box-shadow: none !important;
        border: 1px solid #ddd;
    }
    
    body {
        background: #fff;
    }
}


/* ===== character 字典专用样式 ===== */

.dict-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.dict-card .card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 16px;
}

.dict-card .card-title small {
    color: var(--text-light);
    font-weight: 400;
    font-size: 0.85rem;
}

.dict-card p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.8;
}

.tag-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-group a {
    background: var(--secondary);
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.95rem;
    transition: var(--transition);
    border: 1px solid transparent;
}

.tag-group a:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44, 62, 143, 0.25);
}

.tag-group-sm a {
    background: #f0f2f7;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: var(--transition);
}

.tag-group-sm a:hover {
    background: var(--primary);
    color: #fff;
}

.word-detail h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.word-detail .word-meta {
    font-size: 0.9rem;
    color: var(--text-light);
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.word-detail .word-meta span {
    margin-right: 20px;
}

.word-detail .content {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.9;
}

.word-detail .content h7 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    padding: 12px 0 8px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 12px;
}

.breadcrumb-custom {
    font-size: 0.85rem;
    color: var(--text-light);
    padding: 8px 0 16px;
}

.breadcrumb-custom a {
    color: var(--text-secondary);
}

.breadcrumb-custom a:hover {
    color: var(--primary);
}


/* ===== 修复移动端导航菜单图标 ===== */
.navbar-custom .navbar-toggler-icon {
    display: inline-block;
    width: 1.5em;
    height: 1.5em;
    vertical-align: middle;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(26, 26, 46, 0.8)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100%;
}

/* 在手机端让汉堡图标更明显 */
@media (max-width: 768px) {
    .navbar-custom .navbar-toggler {
        padding: 6px 8px;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
    }
    
    .navbar-custom .navbar-toggler-icon {
        width: 1.8em;
        height: 1.8em;
    }
}