:root {
    --bg-color: #0f111a;
    --text-color: #c0c5ce;
    --accent-logic: #82aaff;
    --accent-spirit: #ffcb6b;
    --accent-life: #c3e88d;
    --accent-senses: #f07178;
    --nav-bg: #1a1c25;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Georgia', serif;
    margin: 0;
    line-height: 1.6;
    /* 防止iOS横向滚动 */
    overflow-x: hidden; 
}

code, pre, .tech-font { font-family: 'Consolas', 'Monaco', monospace; }

a { text-decoration: none; color: inherit; transition: 0.3s; }
a:hover { color: white; }

/* 导航栏 */
nav {
    background: var(--nav-bg);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #333;
    flex-wrap: wrap; /* 允许换行 */
}
.logo { font-size: 1.5rem; font-weight: bold; letter-spacing: 2px; }
.menu { display: flex; gap: 20px; flex-wrap: wrap; }
.menu-item { font-size: 0.9rem; opacity: 0.8; }
.menu-item:hover { opacity: 1; text-shadow: 0 0 8px rgba(255,255,255,0.3); }

/* 分类颜色 */
.cat-logic { color: var(--accent-logic); }
.cat-spirit { color: var(--accent-spirit); }
.cat-senses { color: var(--accent-senses); }
.cat-life { color: var(--accent-life); }

/* 主容器响应式 */
.container { 
    max-width: 900px; 
    margin: 0 auto; 
    padding: 40px 20px; 
}

/* 首页网格 */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 40px;
}
.card {
    background: #1f222e;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #333;
    transition: transform 0.2s;
}
.card:hover { transform: translateY(-5px); border-color: #555; }
.card h3 { margin-top: 0; font-size: 1.2rem; }
.meta { font-size: 0.8rem; opacity: 0.6; margin-bottom: 10px; display: block; }
.tag { 
    display: inline-block; padding: 2px 8px; border-radius: 4px; 
    font-size: 0.75rem; background: #333; margin-right: 5px;
}

/* 文章详情 */
.post-content { background: #1f222e; padding: 40px; border-radius: 8px; }
.post-header { margin-bottom: 30px; border-bottom: 1px solid #333; padding-bottom: 20px; }

/* 分享栏 */
.share-bar { margin-top: 15px; font-size: 0.85rem; }
.share-btn {
    border: 1px solid #444; padding: 2px 8px; margin-right: 5px; border-radius: 2px;
    background: #0f111a; color: #888;
}
.share-btn:hover { border-color: var(--accent-logic); color: var(--accent-logic); }

/* 评论区 */
.comment-section { max-width: 900px; margin: 40px auto 0; padding: 0 20px; }
.comment-list { margin-bottom: 40px; }
.comment-item {
    background: #15171f; border-left: 3px solid #333; padding: 15px; margin-bottom: 15px;
    transition: 0.2s;
}
.comment-item:hover { border-left-color: var(--accent-spirit); background: #1a1c25; }
.comment-meta { font-size: 0.8rem; color: #666; margin-bottom: 5px; display: flex; justify-content: space-between; }
.c-user { color: var(--accent-logic); font-weight: bold; }
.comment-body { font-size: 0.95rem; line-height: 1.5; color: #ccc; word-wrap: break-word; }

.comment-form { background: #1f222e; padding: 20px; border-radius: 8px; border: 1px solid #333; }
.form-group { margin-bottom: 15px; }
.comment-form input, .comment-form textarea {
    width: 100%; background: #0f111a; border: 1px solid #444; color: white;
    padding: 10px; box-sizing: border-box; font-family: 'Consolas', monospace; outline: none;
}
.comment-form input:focus, .comment-form textarea:focus { border-color: var(--accent-spirit); }
.comment-form textarea { height: 80px; resize: vertical; }
.comment-form button {
    background: var(--accent-logic); color: black; border: none; padding: 10px 20px;
    cursor: pointer; font-weight: bold; font-family: 'Consolas', monospace;
}

/* --- 聊天室核心样式 (PC默认) --- */
#chat-btn {
    position: fixed; top: 110px; left: 20px;
    background: var(--nav-bg); border: 1px solid var(--accent-spirit); color: var(--accent-spirit);
    padding: 8px 15px; cursor: pointer; border-radius: 4px; z-index: 1000;
    font-family: 'Consolas', monospace; font-size: 0.9rem;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}
#chat-box {
    position: fixed; top: 160px; left: 20px;
    width: 320px; height: 400px;
    background: rgba(15, 17, 26, 0.95);
    border: 1px solid var(--accent-logic); border-radius: 4px;
    z-index: 2000; display: flex; flex-direction: column;
    box-shadow: 5px 5px 20px rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
}
.hidden { display: none !important; }
.chat-header { background: rgba(26, 28, 37, 0.9); padding: 10px; border-bottom: 1px solid #333; font-size: 0.8rem; color: var(--accent-logic); }
.chat-settings { padding: 5px 10px; background: #15171f; border-bottom: 1px solid #333; display: flex; align-items: center; font-size: 0.8rem; }
.chat-settings input { background: #0f111a; border: 1px solid #333; color: #ffcb6b; padding: 2px 5px; margin-left: 10px; width: 120px; outline: none; font-family: monospace; }
#chat-messages { flex: 1; padding: 10px; overflow-y: auto; font-size: 0.85rem; color: #ddd; }
.chat-input-area { display: flex; border-top: 1px solid #333; min-height: 45px; }
.chat-input-area input { flex: 1; background: transparent; border: none; color: white; padding: 10px; outline: none; font-size: 14px; }
.chat-input-area button { background: var(--accent-logic); border: none; color: black; padding: 0 15px; cursor: pointer; font-weight: bold; }

/* --- 移动端与平板 响应式适配 --- */
@media (max-width: 768px) {
    /* 导航栏调整 */
    nav { padding: 1rem; flex-direction: column; gap: 10px; }
    .menu { gap: 10px; justify-content: center; width: 100%; }
    
    /* 容器调整 */
    .container { padding: 20px 15px; }
    .post-content { padding: 20px; }
    
    /* 聊天室按钮位置调整 (放到底部或悬浮右下，避免挡住Logo) */
    #chat-btn {
        top: auto; bottom: 20px; right: 20px; left: auto;
        background: rgba(26,28,37, 0.9);
        border-color: var(--accent-logic);
        color: var(--accent-logic);
    }

    /* 聊天室移动端全屏模式 (关键修复) */
    #chat-box {
        top: 0; left: 0; bottom: 0; right: 0;
        width: 100%; height: 100%; /* 全屏覆盖 */
        border: none; border-radius: 0;
        background: #0f111a; /* 不透明，避免视觉干扰 */
    }
    
    .chat-header { padding: 15px; font-size: 1rem; display: flex; justify-content: space-between; }
    /* 增大关闭按钮点击区域 */
    .chat-header span[onclick] { padding: 0 10px; font-size: 1.2rem; }
    
    /* 增大输入框文字，防止iOS自动缩放 (iOS < 16px 会zoom) */
    .chat-input-area input { font-size: 16px !important; }
    
    /* 调整输入区域高度，适应手指 */
    .chat-input-area { min-height: 55px; }
    
    /* 确保消息区域可滚动且不被键盘完全遮挡 */
    #chat-messages { -webkit-overflow-scrolling: touch; }
}
/* --- 悬浮按钮组 --- */
#float-btns {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

#chat-btn, #search-btn {
    position: relative; /* 覆盖旧样式 */
    top: auto; left: auto; bottom: auto; right: auto;
    background: rgba(26,28,37, 0.9);
    border: 1px solid var(--accent-spirit);
    color: var(--accent-spirit);
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 4px;
    font-family: 'Consolas', monospace;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    transition: 0.3s;
    text-align: center;
    min-width: 100px;
}
#search-btn {
    border-color: var(--accent-logic);
    color: var(--accent-logic);
}
#search-btn:hover {
    background: var(--accent-logic);
    color: black;
    box-shadow: 0 0 15px var(--accent-logic);
}

/* --- 全屏搜索遮罩 --- */
#search-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 17, 26, 0.95);
    z-index: 3000;
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    padding-top: 100px;
}

.search-container {
    width: 90%;
    max-width: 700px;
}

.search-header {
    color: var(--accent-logic);
    font-size: 1.2rem;
    margin-bottom: 20px;
    border-bottom: 2px solid #333;
    padding-bottom: 10px;
}

#search-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 2px solid #555;
    color: white;
    font-size: 2rem;
    padding: 10px 0;
    outline: none;
    font-family: 'Consolas', monospace;
    transition: 0.3s;
}
#search-input:focus {
    border-color: var(--accent-spirit);
}

#search-results {
    margin-top: 30px;
    max-height: 60vh;
    overflow-y: auto;
}

.search-item {
    padding: 15px;
    border-bottom: 1px dashed #333;
    transition: 0.2s;
}
.search-item:hover {
    background: rgba(255,255,255,0.05);
}
.s-title {
    font-size: 1.2rem;
    color: var(--accent-life);
    margin-bottom: 5px;
}
.s-meta {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 5px;
}
.s-summary {
    font-size: 0.9rem;
    color: #aaa;
}

/* --- 功德箱按钮 --- */
#donate-btn {
    position: relative;
    background: #4a0d0d; /* 暗红色底 */
    border: 1px solid #ffcb6b; /* 金色边框 */
    color: #ffcb6b;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 4px;
    font-family: 'Consolas', monospace;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    transition: 0.3s;
    text-align: center;
    min-width: 100px;
}
#donate-btn:hover {
    background: #ffcb6b;
    color: #4a0d0d;
    box-shadow: 0 0 20px #ffcb6b; /* 金光闪闪 */
}

/* --- 功德箱弹窗 --- */
#donate-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 17, 26, 0.98); /* 几乎不透明的黑 */
    z-index: 3000;
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center; /* 垂直居中 */
    padding: 20px;
    box-sizing: border-box;
}

.donate-container {
    width: 100%;
    max-width: 800px;
    background: #1a1c25;
    border: 2px solid var(--accent-spirit); /* 金色边框 */
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
    max-height: 90vh;
    overflow-y: auto;
}

.donate-header {
    color: var(--accent-spirit);
    font-size: 1.2rem;
    margin-bottom: 20px;
    border-bottom: 1px dashed #555;
    padding-bottom: 10px;
}

.donate-intro {
    text-align: center;
    margin-bottom: 30px;
    color: #ddd;
    font-style: italic;
}

/* --- 二维码网格 --- */
.qr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); /* 响应式网格 */
    gap: 20px;
}

.qr-card {
    background: #0f111a;
    border: 1px solid #333;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    transition: 0.3s;
}
.qr-card:hover {
    border-color: var(--accent-spirit);
    transform: translateY(-5px);
}

.qr-img-box img {
    width: 100%;
    max-width: 150px;
    border-radius: 4px;
    border: 2px solid white;
}

.qr-title {
    margin-top: 10px;
    font-weight: bold;
    font-family: 'Consolas', monospace;
    font-size: 1rem;
}

.qr-desc {
    margin-top: 8px;
    font-size: 0.8rem;
    color: #888;
    line-height: 1.4;
}

/* --- 首页 Tab 样式 --- */
.home-tabs {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
}

.tab-item {
    padding: 8px 20px;
    border: 1px solid #333;
    border-radius: 20px;
    color: #888;
    transition: all 0.3s;
    font-size: 0.9rem;
    text-transform: uppercase;
    background: #0f111a;
}

.tab-item:hover {
    border-color: var(--accent-spirit);
    color: var(--accent-spirit);
}

.tab-item.active {
    background: var(--accent-logic);
    color: #000;
    border-color: var(--accent-logic);
    font-weight: bold;
    box-shadow: 0 0 15px rgba(130, 170, 255, 0.4);
}

/* --- 分页器样式 --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 50px;
    gap: 20px;
}

.page-btn {
    padding: 10px 20px;
    border: 1px solid var(--accent-logic);
    color: var(--accent-logic);
    border-radius: 4px;
    transition: 0.3s;
    cursor: pointer;
}

.page-btn:hover {
    background: var(--accent-logic);
    color: black;
}

.page-btn.disabled {
    border-color: #333;
    color: #555;
    cursor: not-allowed;
    pointer-events: none;
}

.page-info {
    color: #666;
    letter-spacing: 2px;
}
