* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f5f6fa;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
    max-width: 100vw;
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
    overflow-x: hidden;
}

header {
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    color: #fff;
    padding: 30px 40px;
    border-radius: 12px;
    margin-bottom: 24px;
}

header h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

.stats {
    font-size: 14px;
    opacity: 0.9;
}

.stats span { margin-right: 24px; }
.stats strong { font-size: 18px; }

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #999;
}

.empty-state code {
    background: #eee;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 14px;
}

.date-nav {
    background: #fff;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.date-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.date-tab {
    padding: 8px 20px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: #fff;
    color: #555;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
}

.date-tab:hover {
    border-color: #e74c3c;
    color: #e74c3c;
}

.date-tab.active {
    background: #e74c3c;
    border-color: #e74c3c;
    color: #fff;
}

.sub-links {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.sub-links > * {
    min-width: 0;
}

.sub-links a {
    padding: 6px 16px;
    border-radius: 16px;
    font-size: 13px;
    text-decoration: none;
    color: #555;
    background: #f5f6fa;
    transition: all 0.15s;
}

.sub-links a:hover {
    background: #fde8e8;
    color: #c0392b;
}

.date-section {
    margin-bottom: 32px;
}

.date-header {
    font-size: 22px;
    padding: 12px 20px;
    background: #fff;
    border-left: 5px solid #e74c3c;
    border-radius: 6px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.category-title {
    font-size: 17px;
    margin-bottom: 12px;
    padding-left: 12px;
    border-left: 3px solid;
}

.category-title.positive { border-color: #e74c3c; color: #c0392b; }
.category-title.negative { border-color: #27ae60; color: #1e8449; }
.category-title.neutral  { border-color: #95a5a6; color: #7f8c8d; }

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.news-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.15s, box-shadow 0.15s;
}

.news-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.news-card.positive { border-top: 4px solid #e74c3c; }
.news-card.negative { border-top: 4px solid #27ae60; }
.news-card.neutral  { border-top: 4px solid #95a5a6; }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 8px;
}

.card-header > * {
    min-width: 0;
}

.impact-badge {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.impact-badge.positive { background: #fde8e8; color: #c0392b; }
.impact-badge.negative { background: #e8f8ef; color: #1e8449; }
.impact-badge.neutral  { background: #eee;    color: #666; }

.source-tag {
    font-size: 12px;
    color: #999;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 4px;
}

.news-title {
    font-size: 16px;
    margin-bottom: 8px;
    line-height: 1.4;
    overflow-wrap: break-word;
    word-break: break-word;
}

.news-title a {
    color: #2c3e50;
    text-decoration: none;
    overflow-wrap: break-word;
    word-break: break-word;
}

.news-title a:hover { color: #e74c3c; }

.news-summary {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
    line-height: 1.5;
    overflow-wrap: break-word;
    word-break: break-word;
}

.tags, .stocks-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.tag {
    font-size: 12px;
    padding: 2px 10px;
    border-radius: 12px;
}

.sector-tag { background: #eef2ff; color: #4a6cf7; }

.stock-tag { font-weight: 600; overflow-wrap: break-word; word-break: break-word; }
.stock-tag.positive { background: #fde8e8; color: #c0392b; }
.stock-tag.negative { background: #e8f8ef; color: #1e8449; }

.stocks-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.stock-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.stock-item > * {
    min-width: 0;
}

.stock-reason {
    font-size: 12px;
    color: #888;
    overflow-wrap: break-word;
    word-break: break-word;
}

.card-footer {
    font-size: 12px;
    color: #bbb;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}

footer {
    text-align: center;
    padding: 30px 0;
    color: #bbb;
    font-size: 13px;
    overflow-wrap: break-word;
    word-break: break-word;
}

footer p {
    max-width: 100%;
}

.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    background: #e74c3c;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    text-decoration: none;
    box-shadow: 0 2px 12px rgba(231, 76, 60, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s, transform 0.15s;
    z-index: 999;
    /* 提升到 GPU 合成层，修复移动端 fixed 定位跟随滚动的问题 */
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    will-change: transform;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: #c0392b;
    transform: translate3d(0, -2px, 0);
    -webkit-transform: translate3d(0, -2px, 0);
    box-shadow: 0 4px 16px rgba(231, 76, 60, 0.5);
}

@media (max-width: 768px) {
    .container { padding: 10px; }
    header { padding: 20px; }
    header h1 { font-size: 22px; }
    .news-grid { grid-template-columns: 1fr; }
    .back-to-top {
        right: 16px;
        bottom: 20px;
        width: 40px;
        height: 40px;
        font-size: 18px;
        transform: translate3d(0, 0, 0);
        -webkit-transform: translate3d(0, 0, 0);
    }
}
