/* --- 基础变量与重置 --- */
:root {
    --primary: #2e7d32; /* 酸黄瓜绿 */
    --primary-hover: #1b5e20;
    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --text-main: #1c1e21;
    --text-muted: #65676b;
    --border-color: #dddfe2;
    --radius: 8px;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    line-height: 1.6;
}

/* --- 布局容器 --- */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.container-fluid {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* --- 导航栏 --- */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 20px;
}

nav a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
}

nav a:hover {
    color: var(--primary);
}

/* --- 卡片/帖子样式 (Article) --- */
article {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: transform 0.1s ease;
}

article header h2 {
    margin-top: 0;
    font-size: 1.4rem;
}

article a {
    color: var(--text-main);
    text-decoration: none;
}

article a:hover {
    color: var(--primary);
}

/* --- 按钮样式 --- */
button, [role="button"] {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}

button:hover {
    background-color: var(--primary-hover);
}

button.secondary {
    background-color: #e4e6eb;
    color: var(--text-main);
}

button.outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

/* --- 媒体展示 (Reddit 风格) --- */
.media-container {
    display: grid;
    gap: 10px;
    margin: 15px 0;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.media-container img, .media-container video {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    border-radius: var(--radius);
    cursor: zoom-in;
    border: 1px solid var(--border-color);
}

/* --- 评论树 (核心难点) --- */
.main-comment {
    margin-top: 20px;
}

.reply-box {
    margin-left: 20px;
    border-left: 2px solid var(--border-color);
    padding-left: 15px;
    margin-top: 10px;
}

.reply-box:hover {
    border-left-color: var(--primary);
}

.author-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #eee;
}

/* --- 表单控件 --- */
input, textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-sizing: border-box;
    font-size: 1rem;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.2);
}

/* --- 图片上传预览 --- */
.preview-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.preview-item {
    width: 80px;
    height: 80px;
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
}

.preview-item img, .preview-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- 个人资料页优化 --- */
.profile-header {
    text-align: center;
    padding: 40px 0;
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid white;
    box-shadow: var(--shadow);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 20px 0;
    text-align: center;
}

.tab-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab-nav button.active {
    background: var(--primary);
    color: white;
}

/* --- 响应式细节 --- */
@media (max-width: 600px) {
    .container {
        padding: 10px;
    }
    .reply-box {
        margin-left: 10px;
        padding-left: 10px;
    }
    .stats-grid {
        gap: 5px;
    }
}

.hidden { display: none; }
