* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #e0e0e0;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background-color: #f5f5f5;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.header {
    background-color: #2d8a4e;
    text-align: center;
    padding: 10px 15px 5px;
    position: relative;
}

.header-bg {
    max-width: 100%;
    height: 85px;
    background-image: url('/static/images/header.png');
    background-repeat: no-repeat;
    /*
       关键计算：
       center 50% -> 水平居中，垂直方向定位到 50% 的位置（即第3块的起始位置）
       注意：如果你的图片包含4块，第三块的起始点确实是 50% (即 2/4)
    */
    background-position: center 63%;
    background-size: cover;
}

.header h1 {
    color: #fff;
    font-size: 24px;
    margin-top: 0px;
}

.article-list {
    padding: 15px;
}

.article-item {
    display: flex;
    background: #fff;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.article-cover {
    width: 120px;
    min-height: 90px;
    flex-shrink: 0;
    overflow: hidden;
}

.article-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e0e0e0;
    color: #999;
    font-size: 12px;
    min-height: 90px;
}

.article-info {
    padding: 10px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.article-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    max-height: 42px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.article-title a {
    color: #333;
    text-decoration: none;
}

.article-title a:hover {
    color: #2d8a4e;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #999;
    margin-top: 6px;
}

.footer {
    text-align: center;
    padding: 20px;
    background-color: #2d8a4e;
    color: rgba(255,255,255,0.8);
    font-size: 12px;
}

.footer .icp-link {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
}

.footer .icp-link:hover {
    text-decoration: underline;
}

/* Detail page */
.top-card, .bottom-card {
    text-align: center;
    background: #2d8a4e;
    padding: 0px;
}

.card-img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.article-header {
    padding: 15px;
    background: #fff;
    border-bottom: 1px solid #eee;
}

.article-header .article-title {
    font-size: 20px;
    margin-bottom: 10px;
    -webkit-line-clamp: unset;
    max-height: none;
}

.article-header .article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 13px;
}

.article-content {
    padding: 15px;
    background: #fff;
    line-height: 1.8;
    font-size: 15px;
}

.article-content img {
    max-width: 100%;
    height: auto;
}

.article-content video {
    max-width: 100%;
    height: auto;
}

.comment-section, .comments-section, .recommend-section {
    padding: 15px;
    background: #fff;
    margin-top: 10px;
}

.comment-section h3, .comments-section h3, .recommend-section h3 {
    font-size: 16px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #2d8a4e;
}

.form-group {
    margin-bottom: 12px;
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group textarea {
    resize: vertical;
}

.form-group button {
    width: 100%;
    padding: 10px;
    background: #2d8a4e;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    cursor: pointer;
}

.comment-item {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.comment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2d8a4e;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
}

.comment-body {
    flex: 1;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.comment-nickname {
    font-weight: 600;
    font-size: 14px;
}

.comment-date {
    font-size: 12px;
    color: #999;
}

.comment-content {
    font-size: 14px;
    line-height: 1.5;
    word-break: break-all;
}

.expandable {
    max-height: 60px;
    overflow: hidden;
    position: relative;
}

.expandable.expanded {
    max-height: none;
}

.recommend-item {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.recommend-item:last-child {
    border-bottom: none;
}

.recommend-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: #333;
}

.recommend-title {
    font-size: 14px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 10px;
}

.recommend-date {
    font-size: 12px;
    color: #999;
    flex-shrink: 0;
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-state h2 {
    color: #2d8a4e;
    margin-bottom: 10px;
}

.empty-state p {
    color: #999;
    margin-bottom: 20px;
}

.back-link {
    display: inline-block;
    padding: 8px 20px;
    background: #2d8a4e;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
}

/* Back-to-top bar */
.detail-page {
    padding-bottom: 60px;
}

.back-top-bar {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    width: 100%;
    max-width: 480px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 15px;
    background: #2d8a4e;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
    z-index: 999;
}

.back-top-title {
    flex: 1;
    min-width: 0;
    color: #fff;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.back-top-btn {
    flex-shrink: 0;
    width: auto;
    white-space: nowrap;
    padding: 8px 20px;
    background: #fff;
    color: #2d8a4e;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.back-top-btn:active {
    opacity: 0.85;
}

/* Flash animation for top card */
.top-card.flash {
    animation: flash-top 0.5s ease-in-out 2;
}

@keyframes flash-top {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
}
