/* Rows */
/* .entry-content: Kadence indents lists in page content */
.entry-content .cb-games-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.entry-content .cb-games-item {
    position: relative;
    overflow: hidden;
    margin: 0;
    border-top: 2px solid var(--global-palette8);
}

.cb-games-item:last-child {
    border-bottom: 2px solid var(--global-palette8);
}

.cb-games-row {
    position: relative;
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    align-items: start;
    column-gap: 12px;
    /* 19px: the logos' check badges hang 3px below the row */
    padding: 16px 0 19px;
    /* opaque: covers .cb-games-swipe underneath */
    background: var(--global-palette9);
    touch-action: pan-y;
}

.cb-games-swipe {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: flex-end;
    padding-right: 16px;
    background: var(--global-palette13);
    color: var(--global-palette3);
    font-size: 16px;
    line-height: 24px;
    font-weight: 500;
}

.cb-games-item.is-swiping .cb-games-swipe {
    display: flex;
}

/* 120x56 keeps the 460x215 header images uncropped */
.cb-games-cover {
    display: block;
    width: 120px;
    height: 56px;
    overflow: hidden;
    border-radius: 4px;
    background: var(--global-palette7);
}

.cb-games-cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cb-games-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.entry-content .cb-games-title {
    display: -webkit-box;
    align-self: flex-start;
    overflow: hidden;
    color: var(--global-palette3);
    font-size: 16px;
    line-height: 20px;
    font-weight: 500;
    text-decoration: none;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

@media (hover: hover) {
    .entry-content .cb-games-title:hover {
        color: var(--global-palette3);
        text-decoration: underline;
    }
}

.cb-games-line {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* logoCap() in js/account-game-lists.js works out which logos fit, the rest become "+N";
   the tile sizes (28/32), this 8px gap and the +N margin must match it */
.cb-games-logos {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 8px;
    min-width: 0;
    min-height: 28px;
}

.cb-games-more {
    flex: none;
    margin-left: 4px;
    color: var(--global-palette5);
    font-size: 12px;
    line-height: 16px;
    font-weight: 500;
}

/* 44px tap area around the 28px logos */
button.cb-games-logos {
    margin: -8px 0;
    padding: 8px 0;
    border: 0;
    border-radius: 4px;
    text-align: left;
    cursor: pointer;
}

button.cb-games-logos,
button.cb-games-logos:hover,
button.cb-games-logos:focus,
button.cb-games-logos:active {
    background: transparent;
    color: inherit;
    box-shadow: none;
}

button.cb-games-more {
    height: 32px;
    padding: 0 4px;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
}

button.cb-games-more,
button.cb-games-more:hover,
button.cb-games-more:focus,
button.cb-games-more:active {
    background: transparent;
    color: var(--global-palette5);
    box-shadow: none;
}

button.cb-games-more[aria-expanded="true"] {
    color: var(--global-palette3);
}

@media (hover: hover) {
    button.cb-games-more:hover {
        color: var(--global-palette3);
    }
}

@media (max-width: 850px) {
    button.cb-games-logos:has(> .cb-games-none) {
        min-height: 0;
        margin: 0;
        padding: 0;
    }

    .cb-games-line:has(.cb-games-none) .cb-games-bell {
        margin-block: -12px;
    }
}

.cb-games-icon {
    width: 44px;
    height: 44px;
    margin: -8px -8px -8px 0;
}

.cb-games-bell .cb-icon {
    --cb-icon: url("../images/icons/bell.svg");
    width: 24px;
    height: 24px;
}

.cb-games-bell.is-on .cb-icon {
    --cb-icon: url("../images/icons/bell-filled.svg");
    background: var(--global-palette1);
}

/* keeps its column so rows stay aligned when there is nothing to alert */
.cb-games-bell[hidden] {
    display: grid;
    visibility: hidden;
}

/* phones: removing is the swipe gesture (js/account-game-lists.js) */
.cb-games-remove {
    display: none;
}

.cb-games-remove .cb-icon {
    --cb-icon: url("../images/icons/trash-2.svg");
}

/* States */
/* skeleton (Cb_Account_Game_Lists::skeleton()) reuses the real rows' layout */
.cb-games-skeleton-title {
    width: 60%;
}

.cb-games-skeleton-icon {
    display: grid;
    place-items: center;
}

.cb-games-skeleton-icon .cb-skeleton-box {
    width: 24px;
    height: 24px;
}

.cb-games-skeleton-icon--trash .cb-skeleton-box {
    width: 20px;
    height: 20px;
}

.cb-games-skeleton-icon--trash {
    display: none;
}

.cb-games-skeleton-select {
    width: 44px;
    margin-left: auto;
}

.cb-games-empty .cb-icon {
    --cb-icon: url("../images/icons/bookmark.svg");
}

.cb-games--notifications .cb-games-empty .cb-icon {
    --cb-icon: url("../images/icons/bell-off.svg");
}

/* Desktop */
@media (min-width: 851px) {
    .cb-games-row {
        grid-template-columns: 128px minmax(200px, 212px) minmax(0, 1fr) auto auto;
        align-items: center;
        padding: 16px 0;
    }

    .cb-games-body,
    .cb-games-line {
        display: contents;
    }

    .cb-games-cover {
        width: 128px;
        height: 60px;
    }

    .entry-content .cb-games-title {
        align-self: center;
        justify-self: start;
    }

    .cb-service-tile {
        --cb-service-tile: 32px;
    }

    .cb-games-logos {
        min-height: 32px;
    }

    .cb-games-icon {
        margin: 0 0 0 4px;
    }

    .cb-games-remove,
    .cb-games-skeleton-icon--trash {
        display: grid;
        margin-left: -8px;
    }

    /* negative margins: 44px tap area without making the row taller */
    .cb-games-row--note .cb-games-remove,
    .cb-games-row--note .cb-games-skeleton-icon--trash {
        margin: -4px 0 -4px 4px;
    }

    .entry-content .cb-games-skeleton-title {
        align-self: center;
        width: 160px;
    }
}

/* Service tiles */
.cb-games-badge {
    position: absolute;
    right: -3px;
    bottom: -3px;
    display: grid;
    place-items: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--global-palette11);
    box-shadow: 0 0 0 2px var(--global-palette9);
}

.cb-games-badge::before {
    content: "";
    width: 10px;
    height: 10px;
    background: var(--global-palette9);
    -webkit-mask: url("../images/icons/check.svg") center / contain no-repeat;
    mask: url("../images/icons/check.svg") center / contain no-repeat;
}

.cb-games-badge--bell {
    background: var(--global-palette1);
}

.cb-games-badge--bell::before {
    background: var(--global-palette3);
    -webkit-mask-image: url("../images/icons/bell-filled.svg");
    mask-image: url("../images/icons/bell-filled.svg");
}

@media (max-width: 850px) {
    .cb-games-logos .cb-service-tile {
        --cb-service-tile: 28px;
    }
}

@media (min-width: 851px) {
    .cb-service-option .cb-service-tile {
        --cb-service-tile: 28px;
    }
}

/* Pick card */
.cb-games-pick {
    display: grid;
    justify-items: start;
    margin-bottom: 24px;
    padding: 16px;
    border-radius: 4px;
    background: var(--global-palette8);
}

.cb-games-pick[hidden] {
    display: none;
}

/* Groups */
.cb-games-group + .cb-games-group {
    margin-top: 32px;
}

.cb-games-load-row {
    display: flex;
    justify-content: center;
    padding-top: 16px;
}

/* Play menu */
.cb-games-play-menu {
    gap: 4px;
    padding-right: 8px;
}

.cb-games-play-menu .cb-icon {
    --cb-icon: url("../images/icons/chevron-down.svg");
    background: currentColor;
}

/* Select */
.cb-games-check {
    display: none;
}

/* never narrower than its word: a long group label wraps instead */
.cb-list-group-head .cb-games-select {
    flex: none;
    margin-left: auto;
}

.cb-games.is-selecting .cb-games-row {
    grid-template-columns: 24px 120px minmax(0, 1fr);
    cursor: pointer;
}

.cb-games.is-selecting .cb-games-row > *:not(.cb-games-check),
.cb-games.is-selecting .cb-games-row .cb-games-body > * {
    pointer-events: none;
}

.cb-games.is-selecting .cb-games-check {
    display: block;
    align-self: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    box-shadow: inset 0 0 0 2px var(--global-palette7);
}

.cb-games-row[aria-checked="true"] .cb-games-check {
    background: var(--global-palette1);
    box-shadow: none;
}

.cb-games-row[aria-checked="true"] .cb-games-check::before {
    content: "";
    display: block;
    width: 100%;
    height: 100%;
    background: var(--global-palette3);
    -webkit-mask: url("../images/icons/check.svg") center / 16px no-repeat;
    mask: url("../images/icons/check.svg") center / 16px no-repeat;
}

.cb-games-selectbar {
    position: sticky;
    top: var(--cb-list-sticky-top, 0);
    /* above the sticky .cb-list-group-head (z-index 3, components.css) */
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 24px;
    box-sizing: border-box;
    min-height: 56px;
    margin: 0 0 8px;
    padding: 8px 16px;
    border-radius: 4px;
    background: var(--global-palette8);
}

/* while selecting: group boxes dissolve so the sticky bar spans all groups */
.entry-content .cb-games.is-selecting .cb-list-group-head {
    position: static;
}

.cb-games--watchlist.is-selecting .cb-games-group {
    display: contents;
}

.cb-games--watchlist.is-selecting .cb-games-group + .cb-games-group .cb-list-group-head {
    margin-top: 32px;
}

.cb-games-selectbar-count {
    flex: 0 0 auto;
    color: var(--global-palette3);
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
}

.cb-games-selectbar > * {
    flex: none;
    white-space: nowrap;
}

@media (max-width: 359px) {
    .cb-games-selectbar-word {
        display: none;
    }
}

.cb-games-selectbar .cb-games-select-cancel {
    margin: -12px -10px -12px -4px;
}

.cb-games-select-cancel .cb-icon {
    --cb-icon: url("../images/icons/x.svg");
    width: 24px;
    height: 24px;
}

.cb-games-select-all {
    margin-left: auto;
}

.cb-games-selectbar .cb-games-select-remove {
    margin: -12px -16px -12px -10px;
}

.cb-games-select-remove .cb-icon {
    --cb-icon: url("../images/icons/trash-2.svg");
    width: 24px;
    height: 24px;
    background: var(--global-palette1);
}

.cb-games-select-remove.is-notifications .cb-icon {
    --cb-icon: url("../images/icons/bell-off.svg");
}

.cb-games-select-remove[aria-disabled="true"] .cb-icon {
    background: var(--global-palette5);
}

.cb-games-select-remove[aria-busy="true"] {
    cursor: progress;
}

.cb-games-select-remove[aria-busy="true"] .cb-icon {
    --cb-icon: url("../images/icons/loader-circle.svg");
    animation: cb-spin 0.8s linear infinite;
}

@media (min-width: 851px) {
    .cb-games.is-selecting .cb-games-row {
        grid-template-columns: 24px 128px minmax(200px, 212px) minmax(0, 1fr) auto auto;
    }
}

.cb-games.is-selecting .cb-games-item.is-active .cb-games-row--note {
    grid-template-columns: 24px 80px minmax(0, 1fr) auto;
}

.cb-games.is-selecting .cb-games-item.is-arrived .cb-games-row--note {
    grid-template-columns: 80px minmax(0, 1fr) auto;
    cursor: default;
}

.cb-games.is-selecting .cb-games-item.is-arrived .cb-games-check {
    display: none;
}

@media (min-width: 851px) {
    .cb-games.is-selecting .cb-games-item.is-active .cb-games-row--note {
        grid-template-columns: 24px 80px minmax(200px, 212px) minmax(0, 1fr) auto;
    }

    .cb-games.is-selecting .cb-games-item.is-active .cb-games-row--note .cb-games-body {
        grid-column: 3 / 5;
    }

    .cb-games.is-selecting .cb-games-item.is-arrived .cb-games-row--note {
        grid-template-columns: 80px minmax(200px, 212px) minmax(0, 1fr) auto;
    }
}

/* Notifications */
.cb-games-stop[hidden] {
    display: none;
}

/* desktop: title and release share the row's height */
@media (min-width: 851px) {
    .entry-content .cb-games-row--note.has-release .cb-games-title {
        -webkit-line-clamp: 1;
    }
}

.cb-games-row--note {
    grid-template-columns: 80px minmax(0, 1fr) auto;
}

.cb-games-row--note .cb-games-cover {
    width: 80px;
    height: 37px;
}

.cb-games-row--note .cb-games-body {
    row-gap: 4px;
}

.cb-games-release,
.cb-games-ago,
.cb-games-none {
    color: var(--global-palette5);
    font-size: 14px;
    line-height: 20px;
}

/* wraps: the time moves under the logos when they need the whole line */
.cb-games-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    min-width: 0;
}

.cb-games-meta .cb-games-logos {
    flex: none;
}

.cb-games-ago {
    flex: none;
    white-space: nowrap;
}

/* with the row gap: 8px above the logos */
@media (max-width: 850px) {
    .cb-games-row--note .cb-games-meta {
        margin-top: 4px;
    }
}

.cb-games-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* phones: "Rate it" on its own line under the text, Play stays beside the title */
@media (max-width: 850px) {
    .cb-games-item.is-arrived .cb-games-actions {
        display: contents;
    }

    .cb-games-item.is-arrived .cb-games-actions > * {
        grid-column: 3;
        grid-row: 1;
    }

    .cb-games-item.is-arrived .cb-games-actions > .cb-games-rate {
        grid-column: 2;
        grid-row: 2;
        justify-self: start;
        margin-top: 8px;
    }
}

@media (min-width: 851px) {
    .cb-games-row--note {
        grid-template-columns: 80px minmax(200px, 212px) minmax(0, 1fr) auto;
    }

    .cb-games-row--note .cb-games-body {
        display: grid;
        grid-column: 2 / 4;
        grid-template-columns: minmax(200px, 212px) minmax(0, 1fr);
        column-gap: 12px;
        align-items: center;
    }

    .cb-games-row--note .cb-games-title,
    .cb-games-row--note .cb-games-release {
        grid-column: 1;
    }

    .cb-games-row--note .cb-games-meta {
        grid-column: 2;
        grid-row: 1;
    }

    .cb-games-row--note.has-release .cb-games-meta {
        grid-row: 1 / span 2;
    }

}
