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

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-card: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --accent: #2563eb;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* Header */
header {
    background: var(--bg-primary);
    padding: 1.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

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

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

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

.refresh-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.refresh-btn:hover {
    background: var(--border-color);
}

.refresh-btn svg {
    width: 16px;
    height: 16px;
}

.refresh-btn.loading svg {
    animation: spin 1s linear infinite;
}

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

.last-updated {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Bias Control */
.bias-control {
    background: var(--bg-primary);
    padding: 1.25rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

.bias-container {
    max-width: 600px;
    margin: 0 auto;
}

.bias-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.bias-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

#biasIndicator {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.bias-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Custom Slider */
.slider {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-primary);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: transform 0.15s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-primary);
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-md);
}

/* Main Content */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.stories-container {
    display: grid;
    gap: 1rem;
}

/* Story Cards */
.story-card {
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
    display: grid;
    grid-template-columns: 200px 1fr;
}

.story-card:hover {
    box-shadow: var(--shadow-lg);
}

.story-image {
    width: 100%;
    height: 100%;
    min-height: 160px;
    object-fit: cover;
    background: var(--bg-secondary);
}

.story-content {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
}

.story-meta-top {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.story-number {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
}

.story-category {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    font-weight: 600;
}

.story-headline {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.story-headline a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.story-headline a:hover {
    color: var(--accent);
}

.story-summary {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
    flex-grow: 1;
}

.story-footer {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.story-source {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.story-source a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
}

.story-source a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.story-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Footer */
footer {
    background: var(--bg-primary);
    padding: 2rem 1rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
}

footer p {
    color: var(--text-muted);
    font-size: 0.8rem;
    max-width: 500px;
    margin: 0 auto;
}

/* Loading State */
.loading-skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--border-color) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .story-card {
        grid-template-columns: 1fr;
    }

    .story-image {
        height: 180px;
        min-height: auto;
    }

    .story-headline {
        font-size: 1rem;
    }

    .bias-labels span:nth-child(2) {
        display: none;
    }
}

@media (max-width: 480px) {
    .header-actions {
        flex-direction: column;
        width: 100%;
    }

    .refresh-btn {
        width: 100%;
        justify-content: center;
    }
}
