/**
 * pages/library.css — вынесено 1:1 из style.css (этап C.3.2).
 * Pure .library-* (+ потомки). Overrides pages-library-* / wave* / adaptive не трогались.
 * @media library-* остаются в style.css до C.4.
 */

.library-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
    min-height: 520px;
    border: 1px solid var(--va-border, #2a475e);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.library-sidebar {
    background: var(--va-bg-elevated, #171a21);
    border-right: 1px solid var(--va-border, #2a475e);
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.library-sidebar-list {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.library-vlist-viewport {
    height: 100%;
    max-height: calc(100vh - 280px);
    overflow-y: auto;
    overflow-x: hidden;
}

.library-vlist-inner {
    position: relative;
    width: 100%;
}

.library-vlist-window {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    will-change: transform;
}

.library-vlist-empty {
    padding: 12px 8px;
}

.library-sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: transparent;
    border: none;
    color: var(--va-text-muted, #8f98a0);
    cursor: pointer;
    text-align: left;
    border-radius: 2px;
    font-size: 0.9rem;
}

.library-sidebar-item img {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 50%;
    flex-shrink: 0;
}

.library-sidebar-item:hover,
.library-sidebar-item.active {
    background: var(--va-border, #2a475e);
    color: var(--va-text, #c7d5e0);
}

.library-sidebar-item.active {
    border-left: 3px solid var(--va-accent, #66c0f4);
}

.library-detail {
    background: var(--va-bg, #1b2838);
    padding: 0;
}

.library-detail-hero {
    height: 200px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.library-detail-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, color-mix(in srgb, var(--va-bg, #1b2838) 95%, transparent), transparent);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
}

.library-detail-actions {
    display: flex;
    gap: var(--space-3);
    align-items: center;
    padding: 16px 20px;
}

.library-last-played {
    padding: 0 20px 16px;
    color: var(--va-text-muted, #8f98a0);
    font-size: 0.85rem;
}

.library-game-hub-host {
    padding: 0 20px 24px;
}

.lw-side .library-game-hub-host {
    padding: 0;
}

.library-game-hub {
    margin-top: var(--space-2);
}

.library-hub-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: var(--space-4);
    align-items: start;
}

.library-hub-main {
    min-width: 0;
}

.library-hub-side {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.library-detail.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--va-text-muted, #8f98a0);
}

.library-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-top: 20px;
}

.library-row {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    background: #2a2e3d;
    border-radius: 10px;
    padding: 12px 16px;
}

.library-row img {
    width: 60px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    background: #1b1e28;
}

.library-row .title {
    flex: 1;
    font-weight: 500;
}

.library-row .playtime {
    color: #8d8d8d;
    min-width: 60px;
}

/* Лента новостей в библиотеке */
.library-news {
    margin-bottom: 20px;
    padding: var(--space-4);
    background: var(--va-bg-card, #16202d);
    border: 1px solid var(--va-border, #2a475e);
    border-radius: 10px;
}

.library-news-in-panel {
    margin-bottom: 0;
}

.library-news-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.library-news-head h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--va-text, #c7d5e0);
}

.library-news-empty {
    margin: 0;
    font-size: 0.9rem;
}

.library-news-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    max-height: min(480px, 55vh);
    overflow-y: auto;
    padding-right: 2px;
    scrollbar-width: thin;
    scrollbar-color: var(--va-border, #2a475e) transparent;
}

.library-news-thumb {
    display: block;
    width: 72px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    background: var(--va-bg-card, #16202d);
}

.library-news-thumb--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--va-text-muted, #8f98a0);
    border: 1px dashed var(--va-border, #2a475e);
}

.library-news-cat {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    line-height: 1.4;
    white-space: nowrap;
}

.library-news-cat--news {
    background: rgba(102, 192, 244, 0.14);
    color: var(--va-accent, #66c0f4);
}

.library-news-cat--promo {
    background: rgba(164, 208, 7, 0.16);
    color: #b8d926;
}

.library-news-cat--patch {
    background: rgba(255, 159, 67, 0.16);
    color: #ffb347;
}

.library-news-date {
    font-size: 0.72rem;
    color: var(--va-text-muted, #8f98a0);
    white-space: nowrap;
    flex-shrink: 0;
}

.library-news-title {
    margin: 0 0 4px;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--va-text, #c7d5e0);
}

.library-news-summary {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--va-text-muted, #8f98a0);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.library-sidebar .library-search-input {
    flex: 0 0 auto;
    width: 100%;
    min-height: 36px;
    max-height: 36px;
}

.library-overview {
    background: var(--va-bg, #1b2838);
    padding: 0;
    overflow-y: auto;
    max-height: calc(100vh - 180px);
}

.library-overview-news {
    padding: var(--space-4);
}

.library-overview-news .library-news {
    margin-bottom: 0;
    padding: var(--space-4);
}

.library-overview-news .library-news-list {
    max-height: min(520px, 58vh);
}

.library-news-game {
    margin: 0 0 2px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--va-accent, #66c0f4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.library-banners-section {
    margin-top: var(--space-5);
}

.library-banners-section h3 {
    margin-bottom: var(--space-3);
    font-size: 1.1rem;
}

.library-banners-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-3);
}

.library-banner-card {
    border: none;
    padding: 0;
    background: var(--va-bg-card, #16202d);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    text-align: left;
    color: var(--va-text, #c7d5e0);
}

.library-banner-card img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
}

.library-banner-card span {
    display: block;
    padding: 8px 10px;
    font-size: 0.85rem;
}

.library-back-btn {
    margin: 12px 12px 0;
}

.library-web-hint {
    flex: 1 1 100%;
    margin: 0;
    padding: 10px 12px;
    background: var(--va-bg-card, #16202d);
    border-radius: var(--radius-md);
    border: 1px solid var(--va-border, #2a475e);
}

.library-web-hint a {
    color: var(--va-accent, #66c0f4);
}

.library-banner-icon-wrap {
    display: block;
    overflow: hidden;
    border-radius: 6px;
}

.library-banner-icon-wrap img {
    display: block;
    width: 100%;
    height: auto;
}
