/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100vh;
    overflow: hidden;
    font-family: 'Inter', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
}

/* 主容器 */
.main-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: #f5f5f5;
}

/* 顶部标题 */
.page-title {
    position: absolute;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    font-size: 2.25rem;
    font-weight: bold;
    color: #1f2937;
    letter-spacing: 0.5em;
    text-align: center;
}

/* 文字背景容器 */
.text-background-container {
    position: absolute;
    top: 80px; /* 从国际新闻标题下方开始 */
    left: 0;
    right: 0;
    bottom: 120px; /* 留出翻页按钮和footer空间 */
    overflow: hidden;
    user-select: none;
}

.text-background-inner {
    width: 100%;
    height: 100%;
    padding: 1rem;
    font-size: 16px;
    line-height: 20px;
    font-family: 'Monaco', 'Lucida Console', 'Courier New', Consolas, monospace;
    font-feature-settings: "kern" 1;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* 文字网格 */
.text-grid {
    display: grid;
    gap: 0;
    font-family: 'Inter', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 20px;
    letter-spacing: normal;
    font-weight: 400;
    align-items: start;
    vertical-align: top;
    overflow: hidden;
    margin: 0 auto; /* 水平居中 */
}

/* 文字字符 */
.text-char {
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    height: 20px;
    width: 16px;
    min-width: 16px;
    max-width: 16px;
    overflow: hidden;
    text-align: center;
    overflow: visible;
    color: #9ca3af;
    font-size: 16px;
}

.text-char:hover {
    background-color: #dbeafe;
    color: #1d4ed8;
}

.text-char.hovered {
    background-color: #bfdbfe;
    color: #1e40af;
}

.text-char.news-char {
    color: white;
    font-weight: 900;
    background-color: #626469;
    font-family: 'Arial Black', 'Impact', 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    line-height: 0;
    height: 20px;
    text-align: center;
    vertical-align: top;
}

.text-char.news-char.hovered {
    background-color: #bfdbfe;
    color: #1e40af;
}

/* Footer */
.footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2rem;
    background-color: #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.footer-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.75rem;
    color: #d1d5db;
}

.footer-link {
    color: #60a5fa;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: #93c5fd;
}

/* 模态框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 1rem;
}

.modal-content {
    position: relative;
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 64rem;
    max-height: 90vh;
    width: 90vw;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-title {
    flex: 1;
    font-size: 1.5rem;
    font-weight: bold;
    color: #111827;
    padding-right: 2rem;
}

.modal-meta {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background-color: #f3f4f6;
    color: #374151;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(90vh - 200px);
}

.modal-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 0;
}

.loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.modal-error {
    text-align: center;
    padding: 3rem 0;
}

.error-message {
    color: #dc2626;
    font-size: 1.125rem;
    margin-bottom: 1rem;
}

.error-button {
    padding: 0.5rem 1rem;
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.error-button:hover {
    background-color: #1d4ed8;
}

.article-content {
    color: #374151;
    line-height: 1.75;
    white-space: pre-wrap;
}

.article-tags {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.tags-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-right: 0.5rem;
}

.tag {
    padding: 0.25rem 0.75rem;
    background-color: #dbeafe;
    color: #1e40af;
    font-size: 0.875rem;
    border-radius: 9999px;
}

/* 分页控件样式 */
.pagination-container {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
}

.pagination-btn {
    color: white;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease;
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
}

.pagination-btn:hover:not(:disabled) {
    color: #93c5fd;
}

.pagination-btn:disabled {
    color: #6b7280;
    cursor: not-allowed;
}

.page-info {
    color: white;
    font-size: 0.875rem;
    white-space: nowrap;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .page-title {
        font-size: 1.875rem;
        letter-spacing: 0.25em;
    }

    .pagination-container {
        bottom: 2rem;
    }

    .text-background-container {
        bottom: 100px; /* 移动端调整文字背景位置 */
    }

    .pagination-controls {
        padding: 0.5rem 1rem;
        gap: 0.75rem;
    }

    .pagination-btn {
        font-size: 0.75rem;
    }

    .page-info {
        font-size: 0.75rem;
    }
    
    .modal-content {
        width: 95vw;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
        max-height: calc(95vh - 150px);
    }
    
    .modal-title {
        font-size: 1.25rem;
        padding-right: 1rem;
    }
}

/* 隐藏类 */
.hidden {
    display: none !important;
}
