.game-grid {
    display: grid;
    /* grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); */
    grid-template-columns: repeat(3, 1fr);
    gap: 1em;
    width: 100%;
    /* max-width: 980px; */
    margin: 0 auto;
}

@media (max-width: 700px) {

    .game-grid {
        grid-template-columns: repeat(1, 1fr);
        gap: 0.2em;
    }
}

/* Game Box Styling */
.game-box {
    background: #fff;
    border-radius: 0.5em;
    box-shadow: 0 2px 16px #ffd6000c, 0 1.5px 8px #0002;
    padding: 0.5em;
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    min-width: 0;
    transition: box-shadow 0.13s;
}

.game-box.focus {
    box-shadow: 0 2px 16px #ffd6000c, 0 1.5px 8px #0002, 0 0 0 200vh #00000061;
    z-index: 9;
}

/* .game-box.focus>* {
    z-index: 1;
}

.game-box.focus:after {
    background: #00000061;
    position: fixed;
    inset: 0px;
    content: '';
} */

.game-thumbnail {
    position: relative;
    width: 100%;
    aspect-ratio: 464 / 348;
    height: auto;
    /* border-radius: 1em; */
    overflow: hidden;
    background: #faf8e7;
}

.game-thumbnail img {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 1;
    /* border-radius: 1em; */
    border: 2px solid #fa1000;
}

.game-thumbnail>a {
    display: flex;
    aspect-ratio: 464 / 348;
}

.game-thumbnail.p,
.game-thumbnail.p>a {
    aspect-ratio: 464 / 618;
}

.game-thumbnail video {
    aspect-ratio: 464 / 348;
    background: black;

    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;

    border: 2px solid #fa1000;
}

.game-thumbnail img.active {
    opacity: 1;
    z-index: 2;
}

.slide-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: #fff8;
    border: none;
    font-size: 2em;
    border-radius: 50%;
    width: 1.25em;
    height: 1.25em;
    cursor: pointer;
    z-index: 3;
    color: #222;
    outline: none;
    box-shadow: 0 2px 8px #ffd60029;
    transition: background 0.15s;
    display: flex;
    justify-content: center;
    vertical-align: middle;

}

.slide-btn.prev {
    left: 10px;
}

.slide-btn.next {
    right: 10px;
}

.slide-btn:hover {
    background: #ffd600ee;
    color: #111;
}

.slide-dots {
    display: flex;
    gap: 0.4em;
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    background: #ffe066bb;
    transition: background 0.2s;
    cursor: pointer;
    box-shadow: 0 1px 4px #0001;
    position: relative;
    margin: 0 8px;
    margin: 8px;
    /* wider gap for touch targets */
    z-index: 1;
    /* Keep above background */
}


/* .dot::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: transparent;
    pointer-events: all;
    z-index: 0;
} */

.dot.active {
    background: #ffd600;
    box-shadow: 0 2px 8px #ffd6006b;
}

.game-thumbnail .slide-btn {
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.18s;
}

.game-thumbnail:hover .slide-btn,
.game-thumbnail:focus-within .slide-btn {
    opacity: 1;
    pointer-events: auto;
}

.game-meta {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    flex-grow: 1;
}

.game-title {
    margin: 0;
    font-size: 1.25em;
    font-weight: 600;
    /* background: linear-gradient(to bottom, #ff9800 0%, #e64a19 100%); */
    background: linear-gradient(to bottom, #ff9800 0%, #fa1000 100%);

    color: #fff;
    padding: 0.25em;

    overflow-x: scroll;

    scrollbar-width: none;
    -ms-overflow-style: none;
    scrollbar-gutter: stable;
}

.game-title::-webkit-scrollbar {
    display: none;
}

.game-title:hover,
.game-title:focus {
    color: #fff;
}

.game-title h2,
.game-title .h2 {
    font-size: inherit;
    margin: 0;
    white-space: nowrap;
}

.game-desc {
    font-size: 1em;
    color: #434343;
    background: #FEF099;
    border-radius: 0 0 0.7em 0.7em;
    max-height: 4.25em;
    overflow: hidden;
    position: relative;
    transition: box-shadow 0.13s;
    cursor: help;
}

.game-desc.full {
    max-height: unset;
    border-radius: 0.7em;
}

.game-desc.expanded {
    max-height: 42dvh;
    background: #FEF099;
    position: absolute;
    z-index: 1000;
    box-shadow: 0 2px 16px #ffd6000c, 0 1.5px 8px #0002;

    margin-top: 10%;

    width: 100%;

    overflow-y: scroll;

    scrollbar-width: none;
    -ms-overflow-style: none;
    scrollbar-gutter: stable;
}

.game-tags::-webkit-scrollbar,
.game-categorie::-webkit-scrollbar {
    display: none;
}

.game-desc>div {
    padding: 0.65em 1em;
}

.desc-toggle {
    align-self: flex-end;
    border: none;
    color: #8f6205;
    font-weight: 600;
    font-size: 1em;
    cursor: pointer;
    position: sticky;
    left: 100%;
    bottom: 0;
    background: #fff4bd;
    padding: 0.5em 0.65em 0.5em;
    border-top-left-radius: 0.75em;
}

.game-stats {
    display: flex;
    gap: 0.5em;
    font-size: 0.85em;
    flex-wrap: nowrap;
    align-items: baseline;
    color: #917200;
    margin-top: auto;
}

.game-stats * {
    white-space: nowrap;
}

.game-stats time {
    letter-spacing: -1px;
}

.game-stats .material-icons {
    font-size: 1.1em;
    vertical-align: middle;
    margin-right: 0.18em;
}

.star-rating {
    color: #ff9f00;
    font-size: 1.2em;
    margin-left: auto;
}

/* .game-info {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6em 1.1em;
    align-items: center;
    font-size: 0.99em;
    color: #735f11;
    margin: 0.1em 0 0.1em 0;
    padding: 0.5em 0 0.25em;
} */

.game-date {
    color: #393939;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.game-tags,
.game-categories {
    font-size: 0.99em;
    color: #735f11;

    display: flex;
    flex-wrap: nowrap;
    gap: 0.5em;
    max-width: 100%;

    overflow-x: scroll;

    scrollbar-width: none;
    -ms-overflow-style: none;
    scrollbar-gutter: stable;

    margin: 0.1em 0 0.1em 0;
    padding: 0.25em 0 0.25em;
}

.game-tags.full,
.game-categories.full {
    flex-wrap: wrap;
    padding: 0 0 1.5em;
}

.game-tags::-webkit-scrollbar,
.game-categorie::-webkit-scrollbar {
    display: none;
}

.tag,
.category {
    background: #fff7b7;
    color: #6a5201;
    font-size: 0.98em;
    padding: 0.15em 0.85em;
    border-radius: 1em;
    font-weight: 500;
    box-shadow: 0 1px 5px #ffe06622;
    letter-spacing: 0.01em;
    transition: background 0.13s;
    white-space: nowrap;
    text-transform: capitalize;
}

.tag:focus,
.tag:hover,
.tag:active,
.category:focus,
.category:hover,
.category:active {
    background: #e2dba3;
    color: #716001;
    text-decoration: none;
}

.category {
    background: #ffe06644;
    color: #7a5b00;
}

.category:focus,
.category:hover,
.category:active {
    background: #c3ac4e44;
    color: #805b06;
}

.tag h2,
.tag h3,
.category h2,
.category h3 {
    font-size: inherit;
    font-weight: inherit;
    margin: inherit;
}

.game-desc.full .game-stats {
    overflow: auto;
    flex-wrap: wrap;
    gap: 0.5em 1em;
}

.game-controls {
    display: flex;
    gap: 1em;
    align-items: center;
    margin: 0.25em 0 1.5em;
    flex-wrap: wrap;
    justify-content: space-between;
}

.rating-form {
    display: flex;
    gap: 0.5em;
    align-items: center;
    /* margin: 0.25em 0; */
    flex-wrap: nowrap;
    background: #fff;
    border-radius: 1.1em;
    box-shadow: 0 2px 18px #3f51b51a;
    /* border: 1.5px solid #f5f6fa; */
    padding: 0.25em 1em;
}

.rating-form .btn {
    margin: -0.25em 0;
}

.divider {
    flex-grow: 1;
}

.rating-container {
    align-self: stretch;
    display: flex;
}

@media (max-width: 700px) {
    .game-desc.expanded {
        position: fixed !important;
        left: 0.7em !important;
        right: 0.7em !important;
        top: 0.7em !important;
        bottom: 0.7em !important;
        transform: none !important;
        margin-top: 0.4em;
        min-width: unset !important;
        width: auto !important;
        max-width: 96vw;
        margin-top: auto;
        max-height: 50dvh;
        box-shadow: 0 2px 16px #ffd6000c, 0 1.5px 8px 100dvh #00000052;
    }

    .game-stats {


        overflow-x: scroll;

        scrollbar-width: none;
        -ms-overflow-style: none;
        scrollbar-gutter: stable;
    }

    .game-stats::-webkit-scrollbar {
        display: none;
    }

    .game-desc.full {
        max-height: 15em;
        overflow-y: scroll;

        scrollbar-width: none;
        -ms-overflow-style: none;
        scrollbar-gutter: stable;
    }

    .game-desc.full::-webkit-scrollbar {
        display: none;
    }

    .game-controls {
        font-size: 0.85em;
        gap: 0.5em 0.25em;
    }


    .rating-form {
        order: 1;
        margin: auto;
        padding: 0.25em 0.5em;
    }

    .game-controls .rating-container:not(.rated)+.divider {
        display: none;
    }

    .game-tags.full,
    .game-categories.full {
        padding: 0.75em 0 0;
    }
}

html[data-theme="dark"] .game-box {
    background: #292929;
    color: #f6e5c4;
    box-shadow: 0 2px 16px #10101055, 0 1.5px 8px #0004;
}

html[data-theme="dark"] .game-box.focus {
    box-shadow: 0 2px 16px #ffd6000c, 0 1.5px 8px #0006, 0 0 0 200vh #00000061;
}

html[data-theme="dark"] .game-thumbnail {
    background: #18181a;
}

html[data-theme="dark"] .game-thumbnail img {
    /* No change needed for night. */
}

html[data-theme="dark"] .slide-btn {
    background: #232323bb;
    color: #fff8;
    box-shadow: 0 2px 8px #23232344;
}

html[data-theme="dark"] .slide-btn:hover {
    background: #ffd600cc;
    color: #191818;
}

html[data-theme="dark"] .dot {
    background: #3c3c3c;
}

html[data-theme="dark"] .dot.active {
    background: #ffd600;
    box-shadow: 0 2px 8px #ffd600aa;
}

html[data-theme="dark"] .game-meta {
    color: #fff9ed;
}

html[data-theme="dark"] .game-title {
    background: linear-gradient(to bottom, #ffb84d 0%, #ff6b21 100%);
    color: #232325;
    text-shadow: 0 2px 8px #fff7, 0 1px 0 #0003;
}

html[data-theme="dark"] .game-title:hover,
html[data-theme="dark"] .game-title:focus {
    color: #fff;
}

html[data-theme="dark"] .game-title h2,
html[data-theme="dark"] .game-title .h2 {
    color: inherit;
}

html[data-theme="dark"] .game-desc,
html[data-theme="dark"] .game-desc.expanded {
    color: #f6f4e6;
    background: #343438;
    box-shadow: 0 2px 16px #ffd60008, 0 1.5px 8px #0002;
}

html[data-theme="dark"] .game-desc>div {
    padding: 0.65em 1em;
}

html[data-theme="dark"] .desc-toggle {
    color: #ffb800;
    background: rgba(44, 44, 46, 0.93);
    font-weight: 700;
}

html[data-theme="dark"] .game-stats,
html[data-theme="dark"] .game-date {
    color: #ffad34;
}

html[data-theme="dark"] .star-rating {
    color: #ff6400;
}

html[data-theme="dark"] .game-tags,
html[data-theme="dark"] .game-categories {
    scrollbar-width: none;
    -ms-overflow-style: none;
    scrollbar-gutter: stable;
}

html[data-theme="dark"] .game-tags::-webkit-scrollbar,
html[data-theme="dark"] .game-categorie::-webkit-scrollbar {
    display: none;
}

html[data-theme="dark"] .tag,
html[data-theme="dark"] .category {
    background: #655c43;
    color: #ffce51;
}

html[data-theme="dark"] .tag:focus,
html[data-theme="dark"] .tag:hover,
html[data-theme="dark"] .tag:active,
html[data-theme="dark"] .category:focus,
html[data-theme="dark"] .category:hover,
html[data-theme="dark"] .category:active {
    background: #383325;
    color: #d1a943;
    text-decoration: none;
}

html[data-theme="dark"] .category {
    background: #514939;
    color: #ffe17a;
}

html[data-theme="dark"] .category:focus,
html[data-theme="dark"] .category:hover,
html[data-theme="dark"] .category:active {
    background: #3d372b;
    color: #cdb462;
}


.preloader>div {
    display: flex;
    gap: 3em;
}

.preloader>div>div {
    max-width: 300px;
}

.preloader small {
    padding-top: 0.25em;
}

.preloader .h1 {
    padding-bottom: 0.5em;
    font-size: 0.7em;
    margin: auto;
    justify-content: center;
    text-align: center;
    margin-top: -0.5em;
}

@media (max-width: 700px) {
    .preloader>div {
        flex-direction: column;
        gap: 1em;
    }

    .preloader>div>div {
        max-width: 200px;
    }

    .preloader .game-title {
        font-size: 1em;
    }

    .preloader .game-stats {
        display: none;
    }
}

.gallery {
    display: flex;
    flex-direction: column;
    align-content: stretch;
}