/* Layout: Feed (list) — default */
.layout-feed .articles-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.layout-feed .card {
    padding: 10px 14px;
}

.layout-feed .card-summary {
    display: none;
}

.layout-feed .card-title {
    font-size: 14px;
}

/* Layout: Magazine */
.layout-magazine .articles-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.layout-magazine .card {
    padding: 20px;
}

.layout-magazine .card-title {
    font-size: 20px;
    margin-bottom: 8px;
}

.layout-magazine .card-summary {
    -webkit-line-clamp: 4;
    font-size: 15px;
}

/* Layout switcher + settings button */
.header-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.layout-switcher {
    display: flex;
    gap: 2px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2px;
}

.layout-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    transition: all var(--transition);
}

.layout-btn:hover {
    color: var(--text-secondary);
}

.layout-btn.active {
    background: var(--bg-hover);
    color: var(--accent-mint);
}

/* Feed settings panel */
.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 299;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.settings-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    max-width: 90vw;
    background: var(--bg-primary);
    border-left: 1px solid var(--border);
    z-index: 300;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    padding: 16px;
    padding-top: calc(16px + env(safe-area-inset-top, 0px));
}

.settings-panel.open {
    transform: translateX(0);
}

.settings-panel h3 {
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-category {
    margin-bottom: 16px;
}

.settings-category-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.settings-cat-toggle {
    font-size: 10px;
    color: var(--text-muted);
    width: 12px;
}

.settings-cat-name {
    flex: 1;
}

.settings-cat-checkbox {
    flex-shrink: 0;
}

.settings-feed {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}

.settings-feed label {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.settings-feed input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 36px;
    height: 20px;
    background: var(--border);
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: background var(--transition);
    flex-shrink: 0;
}

.settings-feed input[type="checkbox"]::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: transform var(--transition), background var(--transition);
}

.settings-feed input[type="checkbox"]:checked {
    background: var(--accent-mint);
}

.settings-feed input[type="checkbox"]:checked::after {
    transform: translateX(16px);
    background: #fff;
}

/* Scroll to top button */
.scroll-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, background var(--transition), transform 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.scroll-top.visible {
    opacity: 1;
    pointer-events: auto;
}

.scroll-top:hover {
    background: var(--bg-hover);
    color: var(--accent-mint);
}

.scroll-top:active {
    transform: scale(0.9);
}
