* { margin: 0; padding: 0; box-sizing: border-box; }
:root { --header-height: 68px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: #e6e9ef;
    color: #1a1a2e;
}
header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    /* Compact: title + one status line on the left, presence and buttons on the right. */
    padding: 10px 24px;
    padding-top: max(10px, env(safe-area-inset-top));
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.header-title {
    min-width: 0;
    flex: 1 1 auto;
}
header h1 {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 2px;
}
header .status {
    font-size: 0.75rem;
    line-height: 1.3;
    opacity: 0.75;
}
header .status span + span::before {
    content: ' · ';
}
.header-actions {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}
.header-action-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}
.presence-indicator {
    color: rgba(255,255,255,0.78);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    padding-right: 2px;
    text-align: right;
}
.settings {
    position: relative;
    flex: 0 0 auto;
}
.settings-button,
.search-button {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
    color: white;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}
.settings-button:hover,
.settings-button:focus-visible,
.search-button:hover,
.search-button:focus-visible {
    background: rgba(255,255,255,0.16);
    outline: none;
}
.search-button.active {
    background: #ffd166;
    border-color: #ffd166;
    color: #1a1a2e;
    box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.28);
}
.settings-button.active {
    background: #5eead4;
    border-color: #5eead4;
    color: #1a1a2e;
    box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.24);
}
.settings-menu {
    position: absolute;
    right: 0;
    top: 44px;
    width: 340px;
    max-height: min(76vh, 620px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 14px;
    border: 1px solid #e2e5eb;
    border-radius: 12px;
    background: #f7f8fb;
    color: #1a1a2e;
    box-shadow: 0 12px 32px rgba(0,0,0,0.24);
    display: none;
    z-index: 150;
}
.settings-menu.open { display: block; }
.settings-menu-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    padding: 2px 2px 0;
}
.settings-menu-title {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.2;
}
.settings-menu-description {
    color: #64748b;
    font-size: 0.76rem;
    line-height: 1.35;
    margin-top: 3px;
}
.active-filters-badge {
    border-radius: 999px;
    background: #ffe8ed;
    color: #bd2341;
    flex: 0 0 auto;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 4px 8px;
}
.active-filters-badge[hidden] { display: none; }
.settings-section {
    min-width: 0;
    margin: 0 0 10px;
    padding: 12px;
    border: 1px solid #e2e5eb;
    border-radius: 10px;
    background: white;
}
.settings-section:last-of-type { margin-bottom: 0; }
.settings-section-title {
    color: #475569;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    padding: 0 4px;
    text-transform: uppercase;
}
.settings-options {
    display: grid;
    gap: 4px;
}
.settings-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 48px;
    padding: 5px 2px;
    cursor: pointer;
}
.settings-option + .settings-option {
    border-top: 1px solid #edf0f4;
}
.settings-option-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}
.settings-option-label {
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.25;
}
.settings-option-help {
    color: #64748b;
    font-size: 0.74rem;
    font-weight: 400;
    line-height: 1.3;
}
.settings-toggle {
    position: relative;
    width: 40px;
    height: 24px;
    flex: 0 0 auto;
}
.settings-toggle input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}
.settings-toggle-track {
    position: absolute;
    inset: 0;
    border: 1px solid #cbd2dc;
    border-radius: 999px;
    background: #e8ebf0;
    transition: background 150ms ease, border-color 150ms ease;
}
.settings-toggle-track::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    top: 2px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 1px 3px rgba(15,23,42,0.25);
    transition: transform 150ms ease;
}
.settings-toggle input:checked + .settings-toggle-track {
    border-color: #e94560;
    background: #e94560;
}
.settings-toggle input:checked + .settings-toggle-track::after {
    transform: translateX(16px);
}
.settings-toggle input:focus-visible + .settings-toggle-track {
    outline: 3px solid rgba(233,69,96,0.24);
    outline-offset: 2px;
}
.settings-source-actions {
    display: flex;
    gap: 8px;
    margin: 4px 0 10px;
}
.settings-source-actions button {
    border: 1px solid #d7dbe3;
    border-radius: 8px;
    background: #f8fafc;
    color: #1a1a2e;
    cursor: pointer;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    min-height: 32px;
    padding: 0 10px;
}
.settings-source-actions button:hover,
.settings-source-actions button:focus-visible {
    border-color: #e94560;
    color: #e94560;
    outline: none;
}
.source-options {
    display: grid;
    gap: 2px;
}
.source-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.88rem;
    font-weight: 600;
    min-height: 34px;
    padding: 1px 2px;
    cursor: pointer;
}
.source-option input {
    width: 18px;
    height: 18px;
    accent-color: #e94560;
    flex: 0 0 auto;
}
.source-filter-summary {
    color: #64748b;
    font-size: 0.78rem;
    line-height: 1.35;
    margin-top: 10px;
}
.settings-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 2px;
}
.settings-reset {
    border: 0;
    background: transparent;
    color: #bd2341;
    cursor: pointer;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    padding: 6px 4px;
}
.settings-reset:hover,
.settings-reset:focus-visible {
    text-decoration: underline;
    outline: none;
}
.settings-live-note {
    color: #64748b;
    font-size: 0.7rem;
    text-align: right;
}
.tabs {
    display: flex;
    overflow-x: auto;
    background: white;
    border-bottom: 1px solid #ddd;
    position: sticky;
    top: var(--header-height);
    z-index: 99;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    padding: 12px 20px;
    cursor: pointer;
    white-space: nowrap;
    font-size: 0.9rem;
    font-weight: 500;
    color: #555;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}
.tab:hover { background: #f5f5f5; color: #1a1a2e; }
.tab.active {
    color: #e94560;
    border-bottom-color: #e94560;
    font-weight: 600;
}
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 16px;
}
.news-list { display: flex; flex-direction: column; gap: 28px; }
.news-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: box-shadow 0.2s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}
.news-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.news-card.opening {
    opacity: 0.72;
    pointer-events: none;
    box-shadow: 0 0 0 2px rgba(233, 69, 96, 0.22);
}
.news-card.opening .title::after {
    content: " apertura...";
    color: #e94560;
    font-size: 0.82rem;
    font-weight: 600;
}
.news-card .hero {
    /* Same framing as mobile: fill the card width, crop instead of letterboxing.
       Bias slightly upward so faces in portrait photos are not cut off. */
    width: 100%;
    aspect-ratio: 2 / 1;
    height: auto;
    max-height: 400px;
    object-fit: cover;
    object-position: center 30%;
    background: #e8ecf2;
    display: block;
}
.news-card .hero.contain {
    object-fit: contain;
    background: #f8fafc;
}
.news-card .body {
    padding: 16px 18px 14px;
    min-width: 0;
}
.news-card .title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.4;
}
.news-card .summary {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.news-card .card-footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
}
.news-card .meta {
    font-size: 0.75rem;
    color: #999;
    display: flex;
    gap: 12px;
    min-width: 0;
    flex: 1 1 auto;
    flex-wrap: wrap;
}
.news-card .meta .source {
    color: #e94560;
    font-weight: 600;
}
.favorite-button {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 8px;
    background: rgba(255,255,255,0.92);
    color: #64748b;
    cursor: pointer;
    font-size: 1.05rem;
    line-height: 1;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.10);
}
.favorite-button:hover,
.favorite-button:focus-visible {
    border-color: #f59e0b;
    color: #d97706;
    outline: none;
}
.favorite-button.active {
    background: #f59e0b;
    border-color: #f59e0b;
    color: white;
}
.filter-bar {
    margin-bottom: 16px;
    padding: 8px 14px 14px;
    border: 1px solid #dbe2ea;
    border-radius: 12px;
    background: #fff;
    color: #334155;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.filters-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
}
.filters-title {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #475569;
    font-size: 0.85rem;
    font-weight: 600;
}
.filters-title svg { width: 18px; height: 18px; color: #9f1239; }
.filters-edit,
.filter-search button {
    border: 0;
    background: transparent;
    color: #9f1239;
    cursor: pointer;
    font: inherit;
    min-height: 44px;
    min-width: 44px;
}
.filters-edit { font-size: 0.85rem; font-weight: 600; padding: 0 6px; }
.filter-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.filter-chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    min-width: 0;
    padding: 6px 10px;
    border-radius: 7px;
    background: #f1f5f9;
    color: #334155;
    font-size: 0.82rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}
.filter-search { background: #fff1f3; color: #9f1239; gap: 4px; padding: 0 0 0 10px; }
.filter-search > span { min-width: 0; }
.filter-search button { font-size: 1.1rem; flex: 0 0 auto; }
.filters-sources { margin-top: 8px; }
.filters-heading + .filters-sources { margin-top: 0; }
.filters-label { color: #64748b; font-size: 0.75rem; margin-bottom: 7px; }
.filters-count { margin-left: 4px; color: #475569; font-weight: 600; }
.filters-more { min-width: 0; max-width: 100%; }
.filters-more summary {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 44px;
    padding: 0 8px;
    color: #9f1239;
    font-size: 0.82rem;
    cursor: pointer;
    list-style: none;
}
.filters-more summary::-webkit-details-marker { display: none; }
.filters-chevron { width: 6px; height: 6px; border-right: 1.5px solid; border-bottom: 1.5px solid; transform: rotate(45deg); }
.filters-more-open { display: none; }
.filters-more[open] { flex-basis: 100%; }
.filters-more[open] .filters-more-closed { display: none; }
.filters-more[open] .filters-more-open { display: inline; }
.filters-more[open] .filters-chevron { transform: rotate(225deg); }
.filters-expanded { padding-top: 4px; }
.filters-edit:focus-visible,
.filter-search button:focus-visible,
.filters-more summary:focus-visible {
    outline: 2px solid #9f1239;
    outline-offset: 2px;
    border-radius: 6px;
}
.search-modal {
    position: fixed;
    inset: 0;
    z-index: 250;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: calc(var(--header-height) + 22px) 16px 24px;
    background: rgba(16, 20, 34, 0.46);
}
.search-modal.open { display: flex; }
.search-dialog {
    width: min(520px, 100%);
    border-radius: 8px;
    background: white;
    color: #1a1a2e;
    box-shadow: 0 18px 48px rgba(0,0,0,0.28);
    padding: 18px;
}
.search-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.search-dialog h2 {
    font-size: 1.1rem;
    line-height: 1.2;
}
.modal-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: #f1f3f7;
    color: #1a1a2e;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
}
.modal-close:hover,
.modal-close:focus-visible {
    background: #e5e9f0;
    outline: none;
}
.search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}
.search-form input {
    width: 100%;
    height: 42px;
    border: 1px solid #d7dce6;
    border-radius: 8px;
    color: #1a1a2e;
    font: inherit;
    padding: 0 12px;
}
.search-form input:focus {
    border-color: #e94560;
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.14);
    outline: none;
}
.search-submit,
.search-clear {
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 0 14px;
}
.search-submit {
    background: #e94560;
    color: white;
}
.search-submit:hover,
.search-submit:focus-visible {
    background: #d63350;
    outline: none;
}
.search-clear {
    margin-top: 10px;
    background: #f1f3f7;
    color: #1a1a2e;
}
.search-clear:hover,
.search-clear:focus-visible {
    background: #e5e9f0;
    outline: none;
}
.loading {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 1rem;
}
.error {
    text-align: center;
    padding: 40px;
    color: #e94560;
}
.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #ddd;
    border-top-color: #e94560;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 600px) {
    .container { padding: 10px; }
    header { padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); }
    header h1 { font-size: 1.1rem; }
    .settings-button,
    .search-button { width: 34px; height: 34px; }
    .settings-menu {
        right: -2px;
        width: min(340px, calc(100vw - 24px));
        max-height: min(72vh, 600px);
    }
    .search-form { grid-template-columns: 1fr; }
    .search-submit,
    .search-clear { width: 100%; }
    .news-card .hero {
        aspect-ratio: 2 / 1;
        height: auto;
        object-fit: cover;
        object-position: center center;
    }
    .news-card .body { padding: 12px 14px; }
    .news-card .summary {
        -webkit-line-clamp: 2;
    }
    .news-card .meta {
        flex-direction: column;
        gap: 2px;
    }
    .favorite-button {
        width: 28px;
        height: 28px;
    }
    .tab { padding: 10px 14px; font-size: 0.85rem; }
}
