/* Reset & Base */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #2563EB;
    --primary-dark: #1d4ed8;
    --accent: #60a5fa;
    --bg: #f3f3f3;
    --card-bg: #fff;
    --text: #333;
    --text-secondary: #666;
    --text-muted: #999;
    --border: #e8e8e8;
    --shadow: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-hover: 0 2px 8px rgba(0,0,0,0.1);
    --radius: 4px;
    --font: "Helvetica Neue", Helvetica, Arial, "Microsoft Yahei", sans-serif;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.8;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    max-width: 100vw;
}

a { color: var(--text); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary); }
a:visited { color: var(--text); }

img { max-width: 100%; height: auto; }

h1 { font-size: 24px; font-weight: bold; line-height: 1.4; }
h2 { font-size: 20px; font-weight: bold; line-height: 1.4; }
h3 { font-size: 18px; font-weight: bold; line-height: 1.4; }

/* Container - 990px centered */
.container {
    max-width: 990px;
    margin: 0 auto;
    padding: 0 15px;
}

@media (max-width: 767px) {
    .container {
        padding: 0 10px;
        width: 100%;
    }
}

/* Site Brand */
.site-brand {
    padding: 15px 0;
    background: #fff;
    border-bottom: 1px solid var(--border);
    height: 80px;
    display: flex;
    align-items: center;
}
.brand-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 12px;
    max-width: 990px;
    margin: 0 auto;
    padding: 0 15px;
    width: 100%;
}
.brand-link:visited { color: inherit; }
.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: white;
    font-size: 28px;
    font-family: "KaiTi", "STKaiti", serif;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}
.brand-title {
    font-size: 28px;
    font-family: "STKaiti", "KaiTi", "FangSong", "SimSun", serif;
    color: #1a1a1a;
    font-weight: bold;
    margin: 0;
    letter-spacing: 4px;
    display: block;
}
.brand-subtitle {
    font-size: 13px;
    color: #999;
    letter-spacing: 2px;
}

/* Navigation Bar */
.nav-bar {
    background: var(--primary);
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 100;
    height: 46px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.nav-bar-inner {
    max-width: 990px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.nav-bar-inner::-webkit-scrollbar {
    display: none;
}
.nav-bar-link {
    color: #fff !important;
    text-decoration: none;
    padding: 0 18px;
    font-size: 16px;
    font-weight: bold;
    line-height: 46px;
    transition: background 0.2s;
    white-space: nowrap;
}
.nav-bar-link:visited { color: #fff !important; }
.nav-bar-link:hover {
    background: rgba(255,255,255,0.15);
    color: #fff !important;
}
.nav-bar-link.active {
    background: rgba(0,0,0,0.15);
    color: #fff !important;
}

/* Search Bar (hidden from header, now in sidebar) */
.search-bar { display: none; }

/* Footer */
.site-footer {
    background: #1a2a4a;
    border-top: none;
    margin-top: 30px;
    padding: 0;
}
.footer-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 36px 20px 0;
}
.footer-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    padding-bottom: 28px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.footer-col {
    flex: 1;
    min-width: 160px;
}
.footer-col-brand {
    flex: 2;
    min-width: 280px;
}
.footer-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.footer-brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #c0392b;
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    border-radius: 6px;
}
.footer-brand-name {
    font-size: 18px;
    font-weight: bold;
    color: #fff;
}
.footer-desc {
    color: #9aadcc;
    font-size: 13px;
    line-height: 1.7;
    margin: 0;
}
.footer-title {
    font-size: 14px;
    font-weight: 600;
    color: #e8edf5;
    margin: 0 0 14px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(192,57,43,0.6);
    display: inline-block;
}
.footer-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}
.footer-nav li {
    margin: 8px 0;
    font-size: 13px;
    color: #8aa2c4;
    line-height: 1.5;
}
.footer-nav li a {
    color: #a5bddf;
    text-decoration: none;
    transition: color 0.2s;
}
.footer-nav li a:hover {
    color: #fff;
}
.footer-friend {
    padding: 18px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: 13px;
}
.footer-friend-title {
    color: #7e9ac0;
    margin-right: 8px;
}
.footer-friend a {
    color: #7e9ac0;
    text-decoration: none;
    margin: 0 8px;
    transition: color 0.2s;
}
.footer-friend a:hover {
    color: #c0392b;
}
.footer-bottom {
    padding: 16px 0;
    text-align: center;
}
.footer-bottom p {
    margin: 4px 0;
    font-size: 12px;
    color: #6a82a8;
}
.footer-bottom p a {
    color: #6a82a8;
    text-decoration: none;
}
.footer-bottom p a:hover {
    color: #8aa2c4;
}

/* Main Content */
.site-main {
    padding: 20px 0;
    min-height: calc(100vh - 200px);
}

/* Two Column Layout */
.two-col-layout {
    max-width: 990px;
    margin: 0 auto;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.content-left {
    width: 690px;
    min-width: 0;
    flex-shrink: 0;
}
.sidebar-right {
    width: 284px;
    flex-shrink: 0;
}

/* Legacy support for content-with-sidebar */
.content-with-sidebar {
    max-width: 990px;
    margin: 0 auto;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.content-main {
    width: 690px;
    min-width: 0;
    flex-shrink: 0;
}

/* ===== HOMEPAGE CATEGORY SECTIONS ===== */
.home-category-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
}
.home-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 2px solid var(--primary);
    background: #f8faff;
}
.home-category-title {
    font-size: 16px;
    font-weight: bold;
    color: var(--primary);
    margin: 0;
}
.home-category-more {
    font-size: 13px;
    color: var(--text-muted);
}
.home-category-more:hover { color: var(--primary); }
.home-category-list {
    list-style: none;
    padding: 12px 16px;
}
.home-category-list li {
    padding: 6px 0;
    border-bottom: 1px dashed #eee;
    font-size: 15px;
}
.home-category-list li:last-child { border-bottom: none; }
.home-category-list li a {
    color: #333;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.home-category-list li a:hover { color: var(--primary); }

/* ===== SIDEBAR ===== */
.sidebar, .sidebar-right {
    position: sticky;
    top: 66px;
}
.sidebar-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
}
.sidebar-title {
    font-size: 16px;
    font-weight: 700;
    padding: 10px 16px;
    margin: 0;
    background: #f8faff;
    border-bottom: none;
    color: #333;
    border-left: 5px solid #2563EB;
    padding-left: 15px;
}
.sidebar-search {
    padding: 12px;
}
.sidebar-search-form {
    display: flex;
}
.sidebar-search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
    font-size: 14px;
    outline: none;
}
.sidebar-search-input:focus { border-color: var(--primary); }
.sidebar-search-btn {
    padding: 8px 16px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 14px;
    cursor: pointer;
}
.sidebar-search-btn:hover { background: var(--primary-dark); }

.sidebar-list {
    list-style: none;
    padding: 8px 16px;
}
.sidebar-list li {
    padding: 5px 0;
    border-bottom: 1px dashed #eee;
    font-size: 14px;
}
.sidebar-list li:last-child { border-bottom: none; }
.sidebar-list li a { color: #333; }
.sidebar-list li a:hover { color: var(--primary); }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text) !important;
    font-size: 14px;
}
.sidebar-link .count {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
}
.sidebar-link.active, .sidebar-link:hover { color: var(--primary) !important; }

.hot-list { counter-reset: hot; padding: 8px 16px; list-style: none; }
.hot-list li { counter-increment: hot; display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px dashed #eee; }
.hot-list li:last-child { border-bottom: none; }
.hot-list li::before {
    content: counter(hot);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px; height: 20px;
    border-radius: 3px;
    font-size: 12px;
    color: #fff;
    background: var(--text-muted);
    flex-shrink: 0;
}
.hot-list li:nth-child(-n+3)::before { background: var(--primary); }
.hot-list li a { color: #333; font-size: 14px; }
.hot-list li a:hover { color: var(--primary); }

/* ===== BREADCRUMB ===== */
.breadcrumb {
    font-size: 13px;
    margin-bottom: 16px;
    color: var(--text-muted);
    padding: 10px 0;
}
.breadcrumb a { color: var(--text-secondary) !important; }
.breadcrumb a:hover { color: var(--primary) !important; }
.breadcrumb .sep { margin: 0 6px; color: var(--text-muted); }
.breadcrumb .current { color: var(--text); }

/* ===== DREAM LIST (Category page) ===== */
.dream-list {
    margin-bottom: 20px;
}
.dream-item {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}
.dream-item:hover { border-color: #ccc; }
.dream-item-title {
    font-size: 16px;
    margin-bottom: 6px;
}
.dream-item-title a { color: var(--text) !important; }
.dream-item-title a:hover { color: var(--primary) !important; }
.dream-item-summary {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.dream-item-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
}
.luck-label {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 12px;
    color: #fff;
    background: #FF9800;
}

/* ===== DREAM DETAIL ===== */
.dream-detail {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 20px 10px;
}
.dream-title {
    font-size: 24px;
    font-weight: 800;
    color: #2563EB;
    text-align: center;
    line-height: 30px;
    margin: 12px 0;
}
.dream-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    font-size: 14px;
    color: #444444;
    text-align: center;
    line-height: 30px;
    margin-bottom: 20px;
    padding: 0 5px 10px;
    border-bottom: 1px solid var(--border);
}
.meta-category {
    background: #f0f6ff;
    padding: 2px 10px;
    border-radius: 3px;
    color: var(--primary) !important;
    font-size: 14px;
}
.luck-area {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #f0f7ff;
    border-radius: var(--radius);
    margin-bottom: 20px;
}
.luck-score { font-size: 14px; font-weight: 600; color: var(--primary); }
.luck-badge {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    color: #fff;
    background: #4CAF50;
}
.dream-content {
    font-size: 16px;
    line-height: 30px;
    color: #000000;
    text-align: left;
}
.dream-content p { margin: 16px 0; }
.dream-content strong { font-weight: 700; color: #000000; font-size: 16px; }
.dream-content h2 { margin: 20px 0 10px; font-size: 18px; }
.dream-content h3 { margin: 16px 0 8px; font-size: 16px; }

/* Dream Topics */
.dream-topics {
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.topics-label { color: var(--text-muted); font-size: 13px; }
.topic-tag {
    display: inline-block;
    padding: 3px 10px;
    margin: 3px 3px;
    background: #f5f5f5;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 12px;
    color: var(--text-secondary) !important;
}
.topic-tag:hover { background: var(--primary); color: #fff !important; border-color: var(--primary); }

/* Prev/Next Nav */
.dream-nav {
    margin: 16px 0;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.dream-nav p {
    font-size: 16px;
    line-height: 30px;
    margin: 16px 0;
}
.dream-nav p a {
    color: #333;
    text-decoration: none;
}
.dream-nav p a:hover { color: var(--primary); }

/* Related */
.related-section {
    margin-top: 24px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.related-section .section-title {
    font-size: 16px;
    font-weight: 700;
    color: #000;
    border-left: 5px solid #2563EB;
    padding-left: 15px;
    margin-bottom: 12px;
}
.related-list {
    list-style: disc;
    padding-left: 40px;
}
.related-list li {
    font-size: 14px;
    line-height: 21px;
    padding: 4px 0;
}
.related-list li a {
    color: #333;
    text-decoration: none;
}
.related-list li a:hover { color: var(--primary); }

/* ===== SEARCH ===== */
.search-section { margin-bottom: 20px; }
.search-form { display: flex; }
.search-box { display: flex; width: 100%; }
.search-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
    font-size: 14px;
    outline: none;
}
.search-input:focus { border-color: var(--primary); }
.search-btn {
    padding: 10px 20px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 14px;
    cursor: pointer;
}
.search-btn:hover { background: var(--primary-dark); }
.result-count { margin-bottom: 16px; color: var(--text-secondary); font-size: 14px; }

/* Page Title */
.page-title { margin-bottom: 8px; font-size: 20px; }
.page-desc { color: var(--text-secondary); margin-bottom: 16px; font-size: 14px; }

/* ===== ERROR PAGE ===== */
.error-page { text-align: center; padding: 60px 20px; }
.error-code { font-size: 60px; color: var(--primary); margin-bottom: 12px; }
.error-message { font-size: 22px; margin-bottom: 8px; }
.error-desc { color: var(--text-secondary); margin-bottom: 24px; }
.error-msg { background: #ebf4ff; border: 1px solid #93bbf5; padding: 10px 14px; border-radius: 4px; margin-bottom: 16px; }

/* Empty State */
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-secondary); }
.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-hint { font-size: 13px; color: var(--text-muted); margin-top: 8px; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: #fff !important; }
.btn-primary:hover { background: var(--primary-dark); }

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 24px 0;
}
.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 13px;
    color: var(--text) !important;
    background: var(--card-bg);
}
.page-link:hover { border-color: var(--primary); color: var(--primary) !important; }
.page-link.active,
.page-link.page-current {
    background: var(--primary);
    color: #fff !important;
    border-color: var(--primary);
    font-weight: bold;
}
.page-link.page-num:hover {
    background: #f0f7ff;
}
.page-info { font-size: 13px; color: var(--text-secondary); padding: 0 8px; }
.page-ellipsis { padding: 0 6px; color: var(--text-muted); }

/* ===== SCROLL TO TOP ===== */
.scroll-top {
    position: fixed;
    bottom: 40px;
    right: 30px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    box-shadow: 0 2px 6px rgba(37,99,235,0.3);
    z-index: 99;
}
.scroll-top.visible { opacity: 1; visibility: visible; }
.scroll-top:hover { background: var(--primary-dark); }

/* Hot Tags */
.hot-tags {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.hot-label { color: var(--text-muted); font-size: 13px; }
.hot-tag {
    display: inline-block;
    padding: 3px 10px;
    background: #f5f5f5;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 12px;
    color: var(--text-secondary) !important;
}
.hot-tag:hover { background: var(--primary); color: #fff !important; border-color: var(--primary); }

/* Section title for reuse */
.section { margin-bottom: 24px; }
.section-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
    padding-left: 15px;
    border-left: 5px solid #2563EB;
    color: #333;
}

/* ===== MOBILE SEARCH ===== */
.mobile-search {
    display: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .two-col-layout, .content-with-sidebar {
        flex-direction: column;
        padding: 0 16px;
    }
    .content-left, .content-main { width: 100%; }
    .sidebar-right, .sidebar { width: 100%; position: static; }
    .brand-link { width: 100%; padding: 0 15px; }
}

@media (max-width: 767px) {
    /* 防止横向溢出 */
    html, body {
        overflow-x: hidden;
        width: 100%;
    }
    
    * {
        max-width: 100%;
    }
    
    /* 导航栏横向滚动 */
    .nav-bar-inner {
        justify-content: flex-start;
        padding: 0 10px;
    }
    .nav-bar-link {
        padding: 0 14px;
        font-size: 15px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    .nav-bar { height: 46px; }
    .dream-detail { padding: 12px; }
    .dream-title { font-size: 18px; }
    .dream-nav { flex-direction: column; gap: 8px; }
    .nav-next { text-align: left; }
    .home-category-list li { font-size: 14px; }
    
    /* 移动端显示侧边栏 */
    .sidebar-right { 
        display: block; 
        width: 100%;
        margin-top: 20px;
    }
    
    .two-col-layout {
        padding: 10px;
    }
    
    .content-left {
        width: 100%;
        padding: 0;
    }
    .mobile-search {
        display: block;
        padding: 10px 15px;
        background: #fff;
        border-bottom: 1px solid #eee;
    }
    .mobile-search-form {
        display: flex;
        gap: 8px;
    }
    .mobile-search-input {
        flex: 1;
        height: 36px;
        padding: 0 10px;
        border: 1px solid #ddd;
        border-radius: 4px;
        font-size: 14px;
    }
    .mobile-search-btn {
        height: 36px;
        padding: 0 16px;
        background: #2563EB;
        color: #fff;
        border: none;
        border-radius: 4px;
        font-size: 14px;
        cursor: pointer;
    }
    
    /* 优化文章列表在移动端的显示 */
    .dream-item {
        padding: 10px 0;
    }
    
    .dream-item-title {
        font-size: 14px;
        line-height: 1.5;
    }
    
    /* 优化分类卡片 */
    .home-category-section {
        padding: 12px;
        margin-bottom: 10px;
    }
    
    .home-category-title {
        font-size: 16px;
        margin-bottom: 8px;
    }
    
    .home-category-list li {
        font-size: 13px;
        line-height: 1.6;
        padding: 4px 0;
    }
    
    /* 优化侧边栏 */
    .sidebar-widget {
        padding: 12px;
        margin-bottom: 10px;
    }
    
    .sidebar-title {
        font-size: 15px;
        margin-bottom: 10px;
    }
    
    .sidebar-list li {
        font-size: 13px;
        line-height: 1.5;
        padding: 6px 0;
    }
    
    /* Footer responsive */
    .footer-grid {
        flex-direction: column;
        gap: 24px;
    }
    .footer-col,
    .footer-col-brand {
        min-width: auto;
        flex: none;
    }
    .footer-friend {
        padding: 14px 0;
    }
    .footer-friend a {
        display: inline-block;
        margin: 3px 8px;
    }
}

/* Article content pages (about, disclaimer, privacy) */
.article-content {
    padding: 20px 0;
    line-height: 1.8;
    color: var(--text);
}
.article-content h2 {
    font-size: 18px;
    margin: 24px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.article-content p {
    margin: 10px 0;
    font-size: 15px;
}
.article-content ul {
    margin: 10px 0;
    padding-left: 24px;
}
.article-content li {
    margin: 6px 0;
    font-size: 15px;
    line-height: 1.7;
}
