.news-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 16px 56px;
    position: relative;
    overflow-x: hidden;
}

/* Stage G10 audit finding (confirmed live, see STAGE_G10_PLAN.md): a wider
   max-width here alone cannot widen the page beyond 1400px, because
   #mainBody (main.css, shared by every page on the site) already caps its
   own width at 1400px — .news-page is nested inside it, so a child can
   never render wider than that ancestor regardless of its own max-width.
   Overriding #mainBody itself is out of scope (a site-wide element used by
   every page, not just News). The "wide" responsive bucket therefore
   intentionally computes the SAME container width as "desktop" — this is
   a real architectural ceiling, not an oversight.

/* Subtle ambient glow behind the grid — background itself is untouched.
   Width is capped to the viewport so it never forces horizontal overflow
   on narrow screens. */
.news-page::before {
    content: '';
    position: absolute;
    top: 120px;
    left: 50%;
    width: min(900px, 92vw);
    height: 500px;
    transform: translateX(-50%);
    background: radial-gradient(ellipse at center, rgba(212, 168, 83, 0.08) 0%, rgba(212, 168, 83, 0) 70%);
    pointer-events: none;
    z-index: 0;
}

.news-page > * {
    position: relative;
    z-index: 1;
}

/* Stage 15D: public sync banner — sits above the content, never replaces it. */
.news-sync-banner {
    display: flex;
    align-items: center;
    background: rgba(212, 168, 83, 0.1);
    backdrop-filter: blur(var(--blur-glass));
    -webkit-backdrop-filter: blur(var(--blur-glass));
    border: 1px solid rgba(212, 168, 83, 0.3);
    color: var(--accent-primary);
    border-radius: var(--radius);
    padding: 10px 16px;
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.news-header {
    text-align: center;
    margin-bottom: 28px;
}

.news-header h1 {
    color: var(--accent-primary);
    font-weight: 700;
    margin-bottom: 4px;
}

.news-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ============ Filter bar — glass, floating controls ============ */

.news-controls {
    background: var(--bg-glass);
    backdrop-filter: blur(var(--blur-glass));
    -webkit-backdrop-filter: blur(var(--blur-glass));
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    padding: 18px;
    margin-bottom: 28px;
}

.news-search-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.news-search-input {
    flex-grow: 1;
}

.news-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.news-select {
    flex: 1 1 150px;
    min-width: 120px;
}

.news-year-input {
    flex: 0 1 100px;
}

.news-controls .form-control {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.news-controls .form-control:focus {
    box-shadow: 0 0 0 3px rgba(212, 168, 83, 0.12);
}

.news-active-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.news-list-area {
    min-height: 200px;
}

.news-state-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.news-state-message i {
    font-size: 2rem;
    margin-bottom: 12px;
    display: block;
    color: var(--accent-primary);
}

/* ============ Card grid — floating, breathing space ============ */

/* Stage G10: adaptive column count (repeat(auto-fill, minmax(...))) instead
   of a fixed repeat(N) that stopped scaling past a certain width — see
   docs/anime-news/STAGE_G10_PLAN.md for the cardMinWidth/gap this pairs
   with in the matching JS limit calculation (Static/files/code/news.js). */
.news-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    transition: opacity 0.2s ease;
}

.news-loading-dim {
    opacity: 0.5;
    pointer-events: none;
}

.news-card {
    position: relative;
    display: block;
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none !important;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid rgba(212, 168, 83, 0.14);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.38), 0 2px 6px rgba(0, 0, 0, 0.25);
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.25s cubic-bezier(0.22, 1, 0.36, 1),
        border-color 0.25s ease;
    will-change: transform;
}

.news-card:hover {
    transform: translateY(-6px);
    border-color: rgba(212, 168, 83, 0.5);
    box-shadow: 0 22px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(212, 168, 83, 0.15), 0 0 24px rgba(212, 168, 83, 0.12);
    color: var(--text-primary);
}

.news-card-poster {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    background: var(--bg-surface, #1a1a1a);
}

.news-card-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.news-card:hover .news-card-poster img {
    transform: scale(1.03);
}

.news-card-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 2rem;
}

/* Layer 2 — soft gradient so the glass panel text always stays legible,
   regardless of poster brightness. */
.news-card-poster-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(6, 6, 10, 0.95) 0%, rgba(6, 6, 10, 0.55) 32%, rgba(6, 6, 10, 0) 62%);
    pointer-events: none;
}

/* ============ Floating badges ============ */

.news-status-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.68rem;
    font-weight: 600;
    background: rgba(10, 10, 14, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-secondary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.news-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}

.news-status-badge.is-airing .news-status-dot {
    background: #4ade80;
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.7);
}

.news-status-badge.is-airing {
    color: #b9f5cf;
}

.news-status-badge.is-upcoming .news-status-dot {
    background: var(--accent-primary);
    box-shadow: 0 0 6px rgba(212, 168, 83, 0.7);
}

.news-status-badge.is-upcoming {
    color: var(--accent-primary);
}

.news-status-badge.is-finished .news-status-dot {
    background: #8b93a1;
}

.news-card-badges-corner {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
}

.news-pin-badge,
.news-featured-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 0.7rem;
    background: rgba(212, 168, 83, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #0a0a0a;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.news-featured-badge {
    background: rgba(10, 10, 14, 0.65);
    color: var(--accent-primary);
    border: 1px solid rgba(212, 168, 83, 0.6);
}

.news-rating-badge {
    position: absolute;
    bottom: 96px;
    left: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 700;
    background: rgba(10, 10, 14, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(212, 168, 83, 0.35);
    color: var(--accent-primary);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.news-rating-badge i {
    font-size: 0.68rem;
}

/* ============ Layer 3 — glass info panel ============ */

.news-card-glass {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 14px 12px 12px;
    background: rgba(12, 12, 16, 0.42);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    transition: background 0.25s ease;
}

.news-card:hover .news-card-glass {
    background: rgba(18, 18, 24, 0.55);
}

.news-card-title-he {
    font-weight: 700;
    font-size: 0.98rem;
    color: #fff;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.news-card-title-en {
    font-size: 0.76rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.news-card-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

.news-genre-pill {
    background: rgba(212, 168, 83, 0.16);
    border: 1px solid rgba(212, 168, 83, 0.3);
    color: var(--accent-primary);
    border-radius: var(--radius-pill);
    padding: 2px 9px;
    font-size: 0.66rem;
    font-weight: 600;
}

.news-genre-pill-more {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.7);
}

.news-card-meta {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.5);
}

/* ============ Pagination — floating circular buttons ============ */

.news-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin: 36px 0 12px;
}

.news-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--bg-glass);
    backdrop-filter: blur(var(--blur-glass));
    -webkit-backdrop-filter: blur(var(--blur-glass));
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.news-page-btn:not(:disabled):hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    box-shadow: 0 0 16px rgba(212, 168, 83, 0.35);
    transform: translateY(-2px);
}

.news-page-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.news-page-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 16px;
    border-radius: var(--radius-pill);
    background: var(--accent-primary);
    color: #0a0a0a;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 4px 16px rgba(212, 168, 83, 0.4);
}

.news-page-indicator-of {
    font-weight: 500;
    opacity: 0.75;
    margin-inline-start: 4px;
    font-size: 0.82rem;
}

/* Stage G10: the old fixed-column overrides at these breakpoints are gone —
   .news-cards' auto-fill above already produces the right column count at
   any width. Only the non-column-count cosmetic tweaks stay. */
@media (max-width: 640px) {
    .news-card {
        border-radius: 14px;
    }

    .news-rating-badge {
        bottom: 78px;
    }
}

/* ============ Stage G9 — Anime Discovery UI additions ============ */

/* ---- Advanced filters (desktop) ---- */

.news-advanced-toggle {
    white-space: nowrap;
    flex-shrink: 0;
}

.news-advanced-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.news-advanced-panel .news-select {
    flex: 1 1 160px;
    min-width: 130px;
}

.news-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0;
    cursor: pointer;
}

.news-checkbox-label input {
    width: auto;
    margin: 0;
}

/* ---- Mobile filter trigger + drawer ---- */

.news-mobile-filter-trigger {
    display: none;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.news-mobile-result-count {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.news-mobile-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1050;
    display: flex;
    align-items: flex-end;
}

.news-mobile-drawer {
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    border-radius: 18px 18px 0 0;
    padding: 16px;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
}

.news-mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.news-mobile-drawer-header h2 {
    color: var(--accent-primary);
    font-size: 1.1rem;
    margin: 0;
}

.news-mobile-drawer-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    cursor: pointer;
}

.news-mobile-drawer-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.news-mobile-drawer-footer {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.news-mobile-drawer-footer .sbtn {
    flex: 1 1 50%;
    min-height: 44px;
}

/* ---- Sort + view-mode toolbar ---- */

.news-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.news-sort-select {
    max-width: 220px;
}

.news-view-modes {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.news-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 44px;
    min-height: 44px;
    border-radius: var(--radius);
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.news-view-btn:hover {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.news-view-btn.active {
    color: #0a0a0a;
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* ---- Loading skeletons (shaped per view mode, no layout jump) ---- */

.news-skeleton-grid.news-skeleton-poster {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.news-skeleton-grid.news-skeleton-compact {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
}

.news-skeleton-grid.news-skeleton-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.news-skeleton-grid.news-skeleton-detailed {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.news-skeleton-card {
    aspect-ratio: 2 / 3;
    border-radius: 14px;
    background: linear-gradient(100deg, var(--bg-card) 30%, rgba(212, 168, 83, 0.08) 50%, var(--bg-card) 70%);
    background-size: 200% 100%;
    animation: news-skeleton-shimmer 1.4s ease-in-out infinite;
}

.news-skeleton-detailed .news-skeleton-card {
    aspect-ratio: auto;
    height: 96px;
    border-radius: 12px;
}

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

/* ---- Compact Grid view ---- */

.news-compact-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
}

.news-compact-card {
    display: block;
    text-decoration: none !important;
    color: var(--text-primary);
}

.news-compact-poster {
    aspect-ratio: 2 / 3;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-surface, #1a1a1a);
    border: 1px solid rgba(212, 168, 83, 0.14);
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.news-compact-card:hover .news-compact-poster {
    border-color: var(--accent-primary);
    transform: translateY(-3px);
}

.news-compact-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-compact-title {
    margin-top: 6px;
    font-size: 0.74rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-secondary);
}

/* ---- Cards view (image + info always visible, no hover needed) ---- */

.news-info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.news-info-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid rgba(212, 168, 83, 0.14);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none !important;
    color: var(--text-primary);
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.news-info-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-3px);
    color: var(--text-primary);
}

.news-info-card-poster {
    aspect-ratio: 16 / 9;
    background: var(--bg-surface, #1a1a1a);
    overflow: hidden;
}

.news-info-card-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-info-card-body {
    padding: 12px 14px 14px;
}

.news-info-card-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-info-card-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.76rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* ---- Detailed List view ---- */

.news-detailed-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.news-detailed-row {
    display: flex;
    gap: 14px;
    background: var(--bg-card);
    border: 1px solid rgba(212, 168, 83, 0.14);
    border-radius: 12px;
    padding: 12px;
    text-decoration: none !important;
    color: var(--text-primary);
    transition: border-color 0.2s ease;
}

.news-detailed-row:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.news-detailed-poster {
    flex-shrink: 0;
    width: 70px;
    aspect-ratio: 2 / 3;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-surface, #1a1a1a);
}

.news-detailed-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-detailed-body {
    flex-grow: 1;
    min-width: 0;
}

.news-detailed-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 4px;
}

.news-detailed-synopsis {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    line-height: 1.4;
}

.news-detailed-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.news-detailed-channel {
    color: var(--accent-primary);
}

/* ---- Accessibility ---- */

.news-view-btn:focus-visible,
.news-page-btn:focus-visible,
.news-mobile-drawer-close:focus-visible,
.news-card:focus-visible,
.news-compact-card:focus-visible,
.news-info-card:focus-visible,
.news-detailed-row:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .news-card,
    .news-card-poster img,
    .news-compact-poster,
    .news-info-card,
    .news-view-btn,
    .news-page-btn,
    .news-skeleton-card {
        transition: none !important;
        animation: none !important;
    }
}

/* ---- Responsive breakpoints for the new toolbar/views ---- */
/* Stage G10: the fixed-column overrides that used to live in the 1100px/
   640px blocks below are gone — every grid above now uses
   repeat(auto-fill, minmax(...)), which already produces the right column
   count at any width without a breakpoint override. */

@media (max-width: 768px) {
    .news-controls-desktop {
        display: none;
    }

    .news-mobile-filter-trigger {
        display: flex;
    }

    .news-toolbar {
        flex-wrap: wrap;
    }

    .news-sort-select {
        max-width: none;
        flex: 1 1 100%;
        order: 2;
    }

    .news-view-modes {
        order: 1;
        margin-inline-start: auto;
    }
}

@media (max-width: 640px) {
    .news-detailed-row {
        flex-direction: row;
    }

    .news-detailed-poster {
        width: 56px;
    }

    .news-detailed-synopsis {
        display: none;
    }
}
