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

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #202122;
    --text-secondary: #54595d;
    --border-color: #a2a9b1;
    --link-color: #3366cc;
    --link-hover: #447ff5;
    --button-bg: #3366cc;
    --button-hover: #447ff5;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-secondary);
}

header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.search-bar {
    flex: 1;
    max-width: 500px;
}

.search-bar input {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    font-size: 0.95rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    font-size: 0.9rem;
    background: var(--button-bg);
    color: white;
    transition: background 0.2s;
}

.btn:hover {
    background: var(--button-hover);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
}

.main-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    gap: 1rem;
    padding: 1rem;
}

.articles-container {
    display: flex;
    gap: 1rem;
    flex: 1;
}

.article-panel {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    min-height: 500px;
}

.article-panel.single {
    max-width: 900px;
    margin: 0 auto;
}

.article-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.article-title {
    font-size: 1.8rem;
    font-weight: 400;
}

.article-meta {
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.article-content {
    padding: 1.5rem;
    line-height: 1.7;
}

.article-content h1 {
    font-size: 2rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.25rem;
}

.article-content h2 {
    font-size: 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.25rem;
}

.article-content h3 {
    font-size: 1.2rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.article-content p {
    margin-bottom: 1rem;
}

.article-content ul,
.article-content ol {
    margin: 0.5rem 0 1rem 2rem;
}

.article-content li {
    margin-bottom: 0.5rem;
}

.article-content a {
    color: var(--link-color);
    text-decoration: none;
}

.article-content a:hover {
    text-decoration: underline;
}

.version-selector {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    font-size: 0.9rem;
}

.loading {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
}

.empty-state {
    padding: 3rem;
    text-align: center;
    color: var(--text-secondary);
}

.empty-state h2 {
    margin-bottom: 0.5rem;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: 4px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    font-family: inherit;
}

.form-group textarea {
    min-height: 200px;
    font-family: monospace;
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.status-indicator {
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    border-radius: 2px;
}

.status-indicator.connected {
    background: #d4edda;
    color: #155724;
}

.status-indicator.disconnected {
    background: #f8d7da;
    color: #721c24;
}

.popular-list {
    list-style: none;
    padding: 0;
}

.popular-list li {
    margin-bottom: 0.5rem;
}

.popular-list a {
    color: var(--link-color);
    text-decoration: none;
}

.popular-list a:hover {
    text-decoration: underline;
}

@media (max-width: 1024px) {
    .articles-container {
        flex-direction: column;
    }

    .article-panel {
        max-width: 100%;
    }

    .header-content {
        flex-wrap: wrap;
    }

    .search-bar {
        order: 3;
        flex: 1 1 100%;
        max-width: 100%;
    }
}