:root {

    /*--color-background: #272F3C;
    --color-background-dark: #181A21;
    --color-background-light: #344353;*/

    --color-background: #304F6D;
    --color-background-dark: #25374B;
    --color-background-light: #4A6B8C;

    --color-red: #EA5E4C;
    --color-red-2: #F0536D;
    --color-red-3: #C0435D;
    --color-red-4: #8A2E3C;

    --text-color-dark: var(--color-background-dark);

    --color-yellow: #FFE371;
    --color-yellow-2: #FFD25F;
    --color-yellow-3: #E19138;
    --color-yellow-4: #8B4016;

    --color-white: #DAF1FF;
    --color-white-2: #DAF1FF;
    --color-white-3: #B1DCF0;
    --color-white-4: #31566E;

    --color-primary: var(--color-yellow-2);
    --color-secondary: var(--color-red);
    --text-color-secondary: #EE8368;

    --color-detail: #5F86B2;
    --color-detail-light: #C2D7DE;
    --color-alert: #DD523B;
    --color-alert-safe: #F07000;
    --color-warning: #FFD843;
    --color-warning-safe: #FFD437;
    --color-success: #16DE72;
    --color-success-safe: #84D3E7;

    --overlay-gradient: linear-gradient(#19212500 60%,#192125b0);

    --text-color: var(--text-color-light);

    --font-body: "Sofia Sans";
    --font-display: "Sofia Sans Condensed";

    --border-radius: 18px;
    --border-radius-tiny: calc(var(--border-radius-small) - calc(var(--padding-small) * .8));

    --padding-tiny: 4px;
    --padding-small: 8px;
    --padding-text: .5em 1em .5em;
    --padding-text-small: .3em .6em .2em;

    --header-background-color: var(--color-background-dark);

    font-size: 16px;

    --font-size-h2: 2.3rem;
    --font-size-h3: 1.8rem;
}

#header-swipe nav {
    gap: var(--padding-large);
}

nav a {
    font-family: var(--font-display);
    text-transform: uppercase;
    font-weight: 900;
    font-size: 1.2rem;
    color: var(--color-primary);
}

a {
    color: var(--text-color-secondary);
}

.alert-box {
    border-radius: var(--border-radius-small);
    min-width: 200px;
}

.alert-box-content {
    border-radius: calc(var(--border-radius-small) - 2px);
}

main {
    margin-top: calc(var(--header-size) + var(--padding-large));
}

.inline-label {
    font-weight: 800;
}

main:has(.hero-banner:first-child), main:has(.game-detail) {
    margin-top: var(--header-size);
}

strong {
    font-weight: 800;
}

h1 {
    text-transform: uppercase;
    font-weight: 900;
    line-height: .9;
}

h2 {
    text-transform: uppercase;
    font-weight: 900;
}

.p1 {
    font-size: 1.2rem;
    font-weight: 300;
}

.p2 {
    font-size: 1.1rem;
    font-weight: 300;
    line-height: 1.3;
}

summary {
    font-size: 1.4rem;
}

details {
    display: flex
;
    flex-direction: column;
    gap: var(--padding-small);
}

.sup {
    color: var(--text-color);
    font-size: 1.2rem;
}

.h-list {
    gap: var(--padding-small);
}

.columns > * {
    max-width: unset;
}

.v-list-tiny {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--padding-tiny);
}

.vertical-display-large {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--padding-large);
}

.tag, .event-tag {
    padding: var(--padding-text-small);
    font-size: .75rem;
    font-family: var(--font-body), sans-serif;
    border-radius: 6px;
    font-weight: 800;
    text-transform: uppercase;
    background: var(--color-detail);
}

a.tag, a.event-tag {
    color: var(--text-color-light);
}

a.tag:hover, a.event-tag:hover {
    text-decoration: none;
}

.calendar-nav {
    align-self: center;
    background: var(--color-background-dark);
    border-radius: var(--border-radius-tiny);
    display: flex;
    flex-direction: row;
    gap: var(--padding-small);
    padding: var(--padding-tiny);
}

.cn-button {
    background: var(--color-background-light);
    border-radius: calc(var(--border-radius-tiny) - calc(var(--padding-tiny) * .8));
}

.calendar-nav > * {
    padding: var(--padding-text-small);
}

.form-group {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--padding-small);
}

.form-component {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--padding-tiny);
    justify-content: space-between;
}

.form-columns {
    display: flex;
    flex-direction: row;
    gap: var(--padding-small);
    flex-wrap: wrap;
}

.form-columns > * {
    flex: 1 0 0;
}

.event-form-image-wrapper {
    width: 100%;
    height: 300px;
    overflow: hidden;
    border-radius: var(--border-radius-small);
}

input:not([type=radio]):not([type=checkbox]), select, textarea {
    border-radius: var(--border-radius-tiny);
}

/* Default closed */
#repeat-options {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* Toggle link with dropdown arrow */
.toggle-link {
    cursor: pointer;
    color: #007bff;
    text-decoration: none;
    position: relative;
    padding-right: 20px;
    display: inline-block;
    align-self: flex-start;
}

.drop-down-content {
    margin-top: var(--padding-small);
}

.toggle-link::after {
    content: '▼';
    position: absolute;
    right: 0;
    top: 60%;
    transform: translateY(-50%) rotate(0deg);
    transition: 0.2s ease;
    font-size: .7em;
}

/* When active */
.toggle-link.active::after {
    top: 40%;
    transform: translateY(-50%) rotate(-180deg);
}

.drop-down-wrapper {
    background: var(--color-background);
    padding: var(--padding-medium);
    border-radius: var(--border-radius-small);
}

footer {
    background-color: var(--color-background-dark);
}

.style-light {
    background-color: var(--color-background-light);
}

.style-dark {
    background: var(--color-background-dark);
}

.style-light .style-dark {
    background: var(--color-background);
}

#admin-nav {
    display: flex;
    flex-direction: row;
    gap: var(--padding-small);
    background: var(--color-background-light);
    padding: var(--padding-small);
    border-radius: var(--border-radius-tiny);
    overflow: hidden;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: stretch;
}

#admin-nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-tiny);
    padding: var(--padding-text-small);
    white-space: nowrap;
    background: transparent;
    color: var(--text-color-light);
    min-height: 40px;
}

#admin-nav a.is-active {
    background: var(--color-detail-light);
    color: var(--color-background-dark);
    text-decoration: none;
    font-weight: 800;
}

.panel {
    padding: var(--padding-large);
    border-radius: var(--border-radius);
}

.panel-small {
    padding: var(--padding-medium);
    border-radius: var(--border-radius)
}

.tag-event, .tag-hours {
    background: var(--text-color-light);
    font-family: var(--font-display);
    color: var(--text-color-dark);
    font-weight: 800;
    padding: var(--padding-text-small);
    border-radius: var(--border-radius-tiny);
    text-transform: uppercase;
}

.tag-event {
    background: var(--color-red);
    color: var(--text-color-light);
}

.hero-center .hero-banner-content {
    align-items: center;
    justify-content: center;
    text-align: center;
}

.hero-center .button-list {
    justify-content: center;
    align-self: center;
}

.hero-banner-content {
    text-align: left;
    align-items: flex-start;
    justify-content: flex-end;
    height: 100%;
    flex-grow: 1;
}

.hero-banner-content > * {
    max-width: 650px;
}

.hero-banner {
    padding: var(--padding-mega) 0
}

.calendar-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--padding-small);
}

.calendar-header {
    font-weight: bold;
    text-align: center;
}

.calendar-cell {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: var(--padding-small);
    padding: var(--padding-small);
    border-radius: var(--border-radius-small);
    background: var(--color-background-dark);
}

.calendar-cell.calendar-date.today {
    background: var(--color-detail);
}

.calendar-date {
    background: var(--color-background-light);
}

.calendar-day-number {
    font-weight: bold;
    align-self: flex-start;
    width: 1.5em;
    height: 1.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 500px;
}

.today .calendar-day-number {
    background: var(--text-color-light);
    color: var(--color-background);
}

.calendar-event {
    background: var(--calendar-accent, #D0453A);
    border-radius: var(--border-radius-tiny);
    padding: var(--padding-tiny);
    color: var(--text-color-light);
}

.calendar-event-time, .calendar-event-tag {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: .85em;
    padding: 0 var(--padding-tiny);
}

.calendar-event-title {
    background: #ffffff50;
    border-radius: calc(var(--border-radius-tiny) - var(--padding-tiny));
    padding: var(--padding-tiny) var(--padding-tiny);
    font-family: var(--font-body);
    font-weight: 400;
}

.bold-panel {
    background: var(--color-background-dark);
    border-radius: var(--border-radius-mega);
}

.bold-panel-heading {
    background: linear-gradient(var(--color-red), var(--color-red-2));
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    padding: var(--padding-text);
    padding-left: var(--padding-medium);
}

.bold-panel-heading h2 {
    text-transform: uppercase;
    font-weight: 800;
}

.bold-panel-content {
    padding: var(--padding-medium);
}

.event-list {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: var(--padding-medium);
}

.event-list > .event-panel-wrapper {
    flex: 2 0 0%;
}

@media (min-width: 900px) {
    .event-list {
        flex-direction: row;
    }
}

.event-list-button {
    border-radius: var(--border-radius);
    background: var(--color-background-light);
    display: block;
    flex: 1 0 0;
    text-decoration: none!important;
    color: var(--text-color-light);
    font-size: 1.5rem;
    font-weight: 900;
    font-family: var(--font-display), sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    text-align: center;
    padding: var(--padding-medium);
}

.event-panel-wrapper {
    container-type: inline-size;
}

.event-panel {
    border-radius: var(--border-radius);
    background: var(--color-background-light);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow: hidden;
    container-type: inline-size;
    height: 100%;
}

.ep-image {
    height: 230px;
    background: var(--color-background);
}

.ep-image-overlay {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    background: var(--overlay-gradient);
}

.ep-content {
    padding: var(--padding-medium);
    padding-top: 0;
    margin-top: -2.3em;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    z-index: 1;
    gap: 2px;
}

.ep-content .button-wrapper {
    margin-top: var(--padding-small);
}

.ep-content-date {
    font-size: .9rem;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
}

.ep-content h4 {
    font-size: 2rem;
    font-weight: 900;
    text-transform: uppercase;
}

@container (min-width: 700px) {
    .event-panel {
        flex-direction: row;
    }

    .ep-image {
        flex-basis: max(250px, 33%);
        flex-shrink: 0;
    }

    .ep-content {
        margin-top: 0;
        padding-top: var(--padding-medium);
    }

    .ep-content .button-wrapper {
        align-self: flex-start;
    }

    .ep-image-overlay {
        background: transparent;
    }
}

button {
    padding: 0;
    border: 0;
}

.button {
    width: 100%;
    height: unset;
}

/* --- Shared wrapper base --- */
.button-wrapper:has(.button-primary),
.button-wrapper:has(.button-secondary),
.button-wrapper:has(.button-alert) {
    border-radius: var(--border-radius-tiny);
    padding-bottom: 2px;
}

/* --- Variant palettes (define color variables at wrapper level) --- */
.button-wrapper:has(.button-primary) {
    --btn-bg1: var(--color-yellow);
    --btn-bg2: var(--color-yellow-2);
    --btn-bg-wrap: var(--color-yellow-3);
    --btn-text: var(--color-yellow-4);
    --btn-text-hover: var(--color-yellow-4);
}

.button-wrapper:has(.button-secondary) {
    --btn-bg1: var(--color-white);
    --btn-bg2: var(--color-white-2);
    --btn-bg-wrap: var(--color-white-3);
    --btn-text: var(--color-white-4);
    --btn-text-hover: var(--color-white-4);
}

.button-wrapper:has(.button-alert) {
    --btn-bg1: var(--color-red);
    --btn-bg2: var(--color-red-2);
    --btn-bg-wrap: var(--color-red-3);
    --btn-text: var(--color-red-4);
    --btn-text-hover: var(--color-red-4);
}

/* --- Shared button base --- */
.button-primary,
.button-secondary,
.button-alert {
    background: linear-gradient(var(--btn-bg1), var(--btn-bg2));
    border: none;
    color: var(--btn-text);
    text-transform: uppercase;
    font-weight: 800;
    font-family: var(--font-display);
    font-size: 1.2rem;
    padding: var(--padding-text);
    border-radius: var(--border-radius-tiny);
    transition: 75ms;
    height: 100%;
    text-align: center;
}

/* --- Hover effects --- */
.button-wrapper:hover .button-primary,
.button-wrapper:hover .button-secondary,
.button-wrapper:hover .button-alert {
    filter: brightness(110%);
    transform: translateY(-2px);
    color: var(--btn-text-hover);
}

/* --- Wrapper background uses inherited variable --- */
.button-wrapper:has(.button-primary),
.button-wrapper:has(.button-secondary),
.button-wrapper:has(.button-alert) {
    background: var(--btn-bg-wrap);
}

.button-wrapper {
    min-height: unset;
    min-width: unset;
}

.button-wrapper > a,
.button-wrapper > button {
    min-height: 44px;
    min-width: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
}

.pop-hover > * {
    display: block;
    transition: 75ms;
}

.pop-hover:hover > * {
    animation: pop-hover 200ms;
    animation-fill-mode: both;
}

.pop-hover:hover {
    text-decoration: none!important;
}

@keyframes pop-hover {
    0% {
        transform: scale(1);
        box-shadow: 0 0px 0 0 #00000080;
    }
    39% {
        transform: scale(1) translateY(-2px);
        box-shadow: 0 2px 0 0 #00000080;
    }
    40% {
        transform: scale(1.02, 1.05) translateY(-6px);
        box-shadow: 0 6px 0 0 #00000020;
    }
    100% {
        transform: scale(1) translateY(-3px);
        box-shadow: 0 4px 0 0 #00000040;
    }
}

.image-text-box {
    display: grid;
    grid-template-rows: repeat(2, auto);
    gap: var(--padding-large);
}

.image-text-box .content {
    grid-row: 2;
}

.image-text-box .media {
    grid-row: 1;
    min-height: 300px;
    border-radius: var(--border-radius-small);
}

@media (max-width: 799px) {
    .calendar-grid {
        grid-template-columns: repeat(1, 1fr);
    }

    .calendar-header, .calendar-cell:not(.calendar-date) {
        display: none;
    }
}

@media (min-width: 800px) {
    .image-text-box {
        display: grid;
        grid-template-rows: unset;
        grid-template-columns: 1fr 1fr;
    }

    .image-text-box .content {
        grid-row: unset;
        padding: var(--padding-medium) 0;
    }

    .image-text-box .media {
        grid-row: unset;
    }
}

.itb-blank {
    background-color: var(--color-background-dark);
}

.itb-content {
    background-color: var(--color-background-light);
}

.featured-events-list-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--padding-small);
    border-radius: var(--border-radius-small);
    border: 1px solid var(--color-detail);
    padding: var(--padding-tiny);
}

.featured-events-list-item:has(input[type="checkbox"]:disabled) {
    opacity: .4;
}

.featured-events-list-item:has(input[type="checkbox"]:checked) {
    background: var(--color-detail);
}

.featured-events-list-item-content {
    padding: var(--padding-small) 0;
}

.admin-game-list {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--padding-small);
}

.public-game-list {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--padding-small);
}

.pgl__filters {
    background: var(--color-background-dark);
    padding: var(--padding-medium);
    border-radius: var(--border-radius-small);
    display: grid;
    grid-template: "a a a a b" auto "c d e f g" auto / 1fr 1fr 1fr 1fr;
    align-items: end;
    gap: var(--padding-medium);
}

.filters {
    align-items: end;
}

.pgl__filters .pgl__filters__query {
    grid-area: a;
}

.pgl__filters .pgl__filters__available {
    grid-area: b;
}

.pgl__filters .pgl__filters__players {
    grid-area: c;
    min-width: 100%;
    width: 0;
}

.pgl__filters .pgl__filters__time {
    grid-area: d;
    min-width: 100%;
    width: 0;
}

.pgl__filters .pgl__filters__age {
    grid-area: e;
    min-width: 100%;
    width: 0;
}

label:has(input[type=checkbox]), .form-component:has(input[type=checkbox]) {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--padding-small);
    justify-content: flex-start;
}

.agl__row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: var(--padding-small);
    grid-template-rows: 1fr;
    padding: var(--padding-small);
    align-items: center;
    background: var(--color-background-light);
    border-radius: var(--border-radius-small);
    position: relative;
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.agl__row--clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(10, 20, 35, 0.22);
    background: var(--color-detail);
}

.agl__row__overlay-link {
    position: absolute;
    inset: 0;
    z-index: 2;
    border-radius: inherit;
}

.agl__row > .agl__row__thumb,
.agl__row > .agl__row__info {
    position: relative;
    z-index: 1;
    pointer-events: none;
}

.agl__row > .agl__row__buttons {
    position: relative;
    z-index: 3;
}

.pgl__row--header, .pgl__row {
    display: grid;
    grid-template-columns: 5fr minmax(80px, 1fr) minmax(80px, 1fr) minmax(80px, 1fr) minmax(90px, 1fr) minmax(140px, 1fr);
}

.pgl__row--header {
    padding: var(--padding-small);
    gap: var(--padding-small);
    display: grid;
    background: var(--color-background-dark);
    border-radius: var(--border-radius-small);
}

.pgl__row--header--cover {
    width: 60px;
}

.pgl__row {
    gap: var(--padding-small);
    grid-template-rows: 1fr;
    padding: var(--padding-small);
    align-items: center;
    background: var(--color-background-light);
    border-radius: var(--border-radius-small);
    padding-right: var(--padding-medium);
}

.pgl__row--header--players, .pgl__row--header--time, .pgl__row--header--age, .pgl__row--header--shelf, .pgl__row--header--status {
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.pgl__data {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.pgl__data--number {
    font-size: 1.2rem;
    font-family: var(--font-display);
    font-weight: 800;
}

.pgl__row--status {
    text-align: center;
    padding: var(--padding-small);
    border-radius: var(--border-radius-tiny);
    text-transform: uppercase;
    font-weight: 800;
    background: var(--color-alert);
}

.pgl__row--status.is-available {
    background: var(--color-success);
}

.pgl__row-wrapper {
    color: unset;
}

.pgl__row-wrapper:hover .pgl__row {
    text-decoration: none!important;
    background: var(--color-detail);
}

.agl__row__info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    color: inherit;
    text-decoration: none;
    gap: 2px;
}

.agl__row__thumb {
    display: block;
}

.agl__row__meta {
    font-size: .9rem;
    opacity: .85;
}

.agl__row__status-note {
    font-size: .85rem;
    margin-top: -2px;
    opacity: .95;
}

.pgl__row__info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--padding-small);
}

.agl__row__thumb, .pgl__row__thumb {
    aspect-ratio: 1;
    height: 60px;
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius-tiny);
    background: var(--color-background);
    flex-shrink: 0;
}

.agl__row__thumb img, .pgl__row__thumb img {
    position: absolute;
    height: 100%;
    width: 100%;
    object-fit: cover;
}

.agl__row__title, .pgl__row__title {
    font-size: 1.6rem;
}

.agl__row__status {
    text-transform: uppercase;
    font-weight: 900;
}

.agl__row__status.checked-in {
    color: var(--color-success-safe);
}

.agl__row__status.checked-out {
    color: var(--color-warning-safe);
}

.agl__row__status.overdue {
    color: var(--color-alert-safe);
}

.agl__row__buttons {
    display: flex;
    flex-direction: row;
    gap: var(--padding-small);
    padding-right: var(--padding-small);
    z-index: 3;
}

.gl__button__wrapper:not(:has(.delete)) {
    min-width: 150px;
}

.gl__button {
    min-height: 44px;
    padding: var(--padding-small) var(--padding-medium);
    background: var(--color-detail-light);
    border-radius: var(--border-radius-tiny);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--color-background);
    text-transform: uppercase;
    font-weight: 900;
    font-family: var(--font-body);
}

.gl__button:hover {
    text-decoration: none!important;
}

.gl__button.delete {
    padding: var(--padding-small);
    aspect-ratio: 1;
    background: var(--color-alert-safe);
}

.gl__button.delete svg {
    height: 1rem;
    fill: var(--color-background);
}

.gd__description {
    display: flex;
    flex-direction: column;
    gap: var(--padding-medium);
    font-size: 1.2rem;
    line-height: 1.5;
    font-weight: 300;
}

.gd__description *:is(ul, ol) {
    display: flex;
    flex-direction: column;
    gap: var(--padding-small);
}

.tox-statusbar__right-container {
    display: none !important;
}

.pgl__sortbar--mobile {
    display: none;
}

@media (max-width: 699px) {
    .button-list {
        flex-wrap: nowrap;
    }
    .pgl__sortbar--mobile {
        display: flex;
        flex-direction: row;
        gap: var(--padding-medium);
    }

    .pgl__sortbar--mobile > * {
        flex: 1 0 0;
    }

    .pgl__filters {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .pgl__row--header {
        display: none;
    }

    .agl__row {
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        grid-template-areas:
    "a b"
    "c c";
        gap: 0.5rem;
    }

    .agl__row .agl__row__thumb {
        grid-area: a;
    }

    .agl__row .agl__row__info {
        grid-area: b;
    }

    .agl__row .agl__row__buttons {
        grid-area: c;
        padding-right: unset;
        width: 100%;
    }

    .agl__row__buttons .gl__button__wrapper:has(.gl__button:not(.delete)) {
        flex-grow: 1;
        flex-basis: 0;
    }

    .gl__button__wrapper:not(:has(.delete)) {
        min-width: unset;
    }

    .pgl__row--header {
        display: none;
    }

    .pgl__row {
        padding-right: var(--padding-small);
    }

    .pgl__row--header, .pgl__row {
        grid-template: "a a a a" auto "b c d e" auto "f f f f" auto / 1fr 1fr 1fr 1fr;
        gap: var(--padding-medium);
    }

    .pgl__row__info {
        grid-area: a;
    }

    .pgl__row__players {
        grid-area: b;
    }

    .pgl__row__time {
        grid-area: c;
    }

    .pgl__row__age {
        grid-area: d;
    }

    .pgl__row__shelf {
        grid-area: e;
    }

    .pgl__row--status {
        grid-area: f;
    }
}

.thumbs--selectable {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--padding-small);
}
.thumb-card {
    position: relative;
    display: inline-block;
    cursor: pointer;
}
.thumb-card img {
}
.thumb-card.is-selected .thumb-card-image-wrapper {
    border-color: #f5b301;
    box-shadow: 0 0 0 3px rgba(245,179,1,.25);
}

.thumb-card-image-wrapper {
    aspect-ratio: 1 / 1;
    border-radius: .375rem;
    border: 2px solid transparent;
    overflow: hidden;
    position: relative;
}
.thumb-card-image-wrapper img {
    height: 100%;
    width: 100%;
    object-fit: cover;
}
.thumb-badge {
    position: absolute;
    top: .25rem;
    left: .25rem;
    background: #111827;
    color: #fff;
    font-size: .75rem;
    padding: .2rem .4rem;
    border-radius: .25rem;
    font-weight: 600;
}
.thumb-actions {
    text-align: center;
    margin-top: .25rem;
    font-size: .9rem;
}

.thumb-card.is-deleted {
    opacity: 0.55;
    filter: grayscale(1);
    position: relative;
}

.thumb-card.is-deleted .thumb-badge {
    display: none;
}

.thumb-card.is-deleted input[type="radio"][name="thumbnail_image_id"] {
    display: none;
}

/* Base wrapper */
.data-table {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.data-table__cell-span {
    grid-column: 1 / -1;
    padding: var(--padding-tiny);
    margin-bottom: var(--padding-tiny);
    border-radius: var(--border-radius-tiny);
}

.data-table__header-row {
    font-weight: 800;
    border-bottom: 1px solid var(--color-background-dark);
}

.data-table__mobile-only {
    display: none;
}

.data-table__row {
    border-bottom: 1px solid var(--color-background);
}

/* Rentals table layout */
.rentals-table .data-table__header-row,
.rentals-table .data-table__row {
    display: grid;
    grid-template-columns:
    1fr   /* Customer  */
    1fr /* Employee  */
    1fr   /* Out       */
    1fr   /* Due       */
    1fr   /* Returned  */
    1fr; /* Action    */
    align-items: center;
}

/* Cells */
.rentals-table .data-table__cell {
    padding: 0.5rem;
}

/* Mobile layout */
@media (max-width: 700px) {
    .rentals-table .data-table__header-row {
        display: none;
    }

    .rentals-table .data-table__row {
        display: grid;
        grid-template-columns: 1fr;
    }

    .rentals-table .data-table__cell {
        display: flex;
        justify-content: space-between;
        padding: 0.25rem 0;
    }

    .data-table__mobile-only {
        display: inline;
    }
}

.thumb-actions {
    display: flex;
    flex-direction: row;
    gap: var(--padding-tiny);
}

.img-thumb-btn, .img-undo-btn {
    flex-grow: 1;
}

.admin-button--small {
    padding: var(--padding-tiny);
    background: var(--color-detail-light);
    border-radius: var(--border-radius-tiny);
    font-weight: 600;
    font-size: .8rem;
    min-height: 32px;
}

.thumb-actions > * {
    min-height: 32px;
}

.img-delete-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 32px;
    background: var(--color-alert-safe);
    color: var(--text-color-light);
}

.img-delete-btn svg {
    height: .8rem;
}


.related-picker {
    position: relative;
}

.related-picker__controls {
    position: relative;
}

.related-picker__results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-background-light);
    border: 1px solid var(--color-detail);
    border-radius: var(--border-radius-tiny, 4px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    max-height: 220px;
    overflow-y: auto;
    z-index: 1000; /* ensures it appears above other form elements */
    display: none;
}

.related-picker__results.active {
    display: block;
}

.related-picker__result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    cursor: pointer;
}

.related-picker__result:hover {
    background: var(--color-detail);
}

.related-picker__result img {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 4px;
}

#related_list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--padding-small);
}

.related-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--padding-small);
    border: 1px solid var(--color-detail);
    padding: var(--padding-small);
    border-radius: var(--border-radius-small);
}

.related-card__name {
    flex-grow: 1;
}

.related-card img {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 4px;
}

.game-detail {
    width: 100%;
    display: grid;
    /*grid-template: "a b" auto "c c" auto / 1fr 1fr;*/
    grid-template-columns: 1fr min(calc(var(--fixed-width)* .5), calc(var(--fixed-max-width-large)* .5)) min(calc(var(--fixed-width)* .5), calc(var(--fixed-max-width-large)* .5)) 1fr;
    grid-template-rows: 60px 0fr 1fr auto;
    gap: var(--padding-medium);
}

.gd__images {
    grid-row: 2 / 4;
    grid-column: 2 / 3;
}

.gd__name {
    grid-row: 2 / 3;
    grid-column: 3/4;
    padding: var(--padding-medium) 0;
}

.gd__info {
    grid-row: 3 / 4;
    grid-column: 3 / 4;
}

.gd__more-info {
    grid-row: 4/5;
    grid-column: 2/4;
}

.gd__background {
    grid-row: 1 / 3;
    grid-column: 1 / -1;
    position: relative;
    z-index: -1;
    overflow: hidden;
}

.gd__background__overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top: 0;
    background: linear-gradient(#00000000, #000000a0);
    z-index: 1;
}

.gd__background img {
    filter: blur(30px);
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.2);
}

.gd__images.no-images {
    background: var(--color-background-dark);
    padding: var(--padding-small);
    border-radius: var(--border-radius-small);
}

/* ===== Game Detail Gallery ===== */
.gd-gallery {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
}

/* --- Main image area --- */
.gd-gallery__stage {
    position: relative;
    width: 100%;
    max-width: 600px;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-small);
    background: var(--color-background-dark);
}

.gd-gallery__main {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.25s ease;
}

/* --- Navigation arrows --- */
.gd-gallery__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    height: 44px;
    width: 44px;
    opacity: 0.7;
    transition: opacity 0.2s;
    user-select: none;
    background: #000000c0;
    color: var(--text-color-light);
    border-radius: var(--border-radius-tiny);
    z-index: 1;
}

.gd-gallery__nav:hover:not(:disabled) {
    opacity: 1;
}

.gd-gallery__nav:disabled {
    opacity: 0.3;
    cursor: default;
}

.gd-gallery__nav--prev {
    left: 0.25rem;
}

.gd-gallery__nav--next {
    right: 0.25rem;
}

/* --- Thumbnails --- */
.gd-gallery__thumbs {
    display: flex;
    gap: var(--padding-small, 0.5rem);
    width: 100%;
    max-width: 600px;
    overflow: scroll;
    padding: var(--padding-small);
}

.gd-gallery__thumbs::-webkit-scrollbar {
    display: none;
}

.gd-thumb {
    flex: 0 0 15%;
    display: block;
    aspect-ratio: 1;
    overflow: hidden;
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s, outline 0.2s;
    border-radius: var(--border-radius-tiny);
    background: var(--color-background-dark);
}

.gd-thumb.is-selected {
    opacity: 1;
    outline: 2px solid var(--color-accent, #555);
}

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

/* --- Noscript fallback --- */
.gd-gallery__noscript {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gd-gallery__noscript-thumbs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.gd-gallery__noscript-thumbs img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--border-radius-tiny, 4px);
}

.gd__info__tags {
    display: flex;
    flex-direction: row;
    gap: var(--padding-small);
}

.gd__info__tags > * {
    background: var(--color-background-light);
    padding: var(--padding-tiny) var(--padding-medium);
    border-radius: var(--border-radius);
    font-weight: 700;
}

.gd-availability {
}

.gd-availability__status {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    border: 2px solid;
    border-radius: var(--border-radius-tiny);
    padding: var(--padding-tiny) var(--padding-small);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.gd-availability__status-main {
    display: block;
    text-align: center;
    width: 100%;
}

.gd-availability__status--stacked {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: var(--padding-small);
    padding: var(--padding-small);
}

.gd-availability__status--stacked .gd-notify {
    margin-top: 0;
}

.gd-availability__status--stacked .note {
    width: 100%;
    margin: 0;
    text-transform: none;
}

.gd-availability__status--available {
    border-color: var(--color-success);
    color: var(--color-success);
}

.gd-availability__status--unavailable {
    border-color: var(--color-red);
    color: var(--color-red);
}

.gd-availability__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--padding-small);
}

.gd-availability__actions .button-wrapper {
    flex: 1 1 0;
    max-width: 360px;
}

.gd-availability__actions .button-wrapper > * {
    width: 100%;
}

.gd-notify {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
}

.gd-notify__summary {
    list-style: none;
    cursor: pointer;
    padding: 0;
    font-weight: 800;
    font-size: 0.9rem;
    text-decoration: underline;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-color-light);
    text-align: center;
    align-self: center;
}

.gd-notify__summary::-webkit-details-marker {
    display: none;
}

.gd-notify__summary::after {
    content: "";
}

.gd-notify[open] .gd-notify__summary::after {
    content: "";
}

.gd-notify__panel {
    padding-top: var(--padding-small);
    width: 100%;
}

@media (max-width: 699px) {
    :root {
        --fixed-width: calc(100vw - calc(var(--padding-medium) * 2));
    }

    .game-detail {
        grid-template: "a" auto "b" auto "c" auto "d" auto / auto;
        justify-items: center;
    }

    .gd__background {
        grid-area: a;
        align-self: stretch;
        justify-self: stretch;
    }

    .gd__info__tags {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .gd__name {
        grid-area: a;
        max-width: var(--fixed-width);
    }

    .gd__images {
        grid-area: b;
        max-width: var(--fixed-width);
    }

    .gd__info {
        grid-area: c;
        max-width: var(--fixed-width);
    }

    .gd__more-info {
        grid-area: d;
        max-width: var(--fixed-width);
    }

}

/* ---- Responsive Video Embeds ---- */
.gd-gallery__video,
.gd-howto__video {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--border-radius-small, 0.5rem);
}

/* Ensures the iframe fits the container */
.gd-embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

/* In case aspect-ratio is not supported */
@supports not (aspect-ratio: 16 / 9) {
    .gd-gallery__video,
    .gd-howto__video {
        height: 0;
        padding-bottom: 56.25%; /* 9 / 16 * 100 */
    }
    .gd-embed {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
}

.pgl__sort {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}
.pgl__sort-label {
    font-weight: 600;
}
.pgl__sort-arrows {
    display: inline-flex;
    flex-direction: column;
    line-height: 1;
}
.pgl__sort-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 14px;
    opacity: .65;
    text-decoration: none;
}
.pgl__sort-link.is-active { opacity: 1; }
.pgl__sort-arrow { display: block; }

.pgl__arrow-svg polygon {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linejoin: round;
    opacity: 1;
}
.pgl__sort-link.is-active .pgl__arrow-svg polygon {
    fill: currentColor;
    opacity: 1;
}

.toggle-group {
    width: 100%;
    display:flex;
    border: 2px solid var(--color-background);
    border-radius: var(--border-radius-tiny);
    overflow: hidden;
}

.toggle-group > * {
    flex: 1 0 0;
}

.toggle-btn {
    background: var(--color-background);
    padding: var(--padding-small);
    color: var(--text-color-light);
    font-weight: 900;
    text-transform: uppercase;
    font-size: .9rem;
}
.toggle-btn.is-active {
    background: var(--color-detail-light);
    color: var(--color-background-dark);
}

.dynamic-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--padding-medium);
}

@media (max-width: 600px) {
    .dynamic-grid {
        display: flex;
        flex-direction: column;
    }
}

.game-display-mini {
    display: flex;
    flex-direction: column;
    gap: var(--padding-small);
    background: var(--color-background-dark);
    padding: var(--padding-small);
    border-radius: var(--border-radius-large);
}

.gdm__media {
    height: 200px;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.gdm__content {
    padding: 0 var(--padding-small);
}

.admin-split-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--padding-medium);
}

.customer-identity {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.customer-identity__name {
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.2;
    color: inherit;
}

p.customer-identity__name {
    margin: 0;
}

.customer-identity__line {
    margin: 0;
    opacity: .92;
}

.customer-identity--compact .customer-identity__name {
    font-size: 1rem;
}

.customer-identity--card {
    background: var(--color-background);
    border-radius: var(--border-radius-tiny);
    padding: var(--padding-small);
}

.customer-list {
    display: flex;
    flex-direction: column;
    gap: var(--padding-small);
}

.customer-list__item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--padding-medium);
    padding: var(--padding-small);
    border-radius: var(--border-radius-tiny);
    background: var(--color-background);
    color: inherit;
}

.customer-list__item:hover {
    text-decoration: none;
    background: var(--color-detail);
}

.customer-list__count {
    white-space: nowrap;
    font-weight: 700;
}

.customer-rentals,
.checkout-game-options,
.checkout-customer-options,
.checkout-open-rentals,
.waitlist-cards,
.rental-history-list {
    display: flex;
    flex-direction: column;
    gap: var(--padding-small);
}

.customer-rentals__item,
.checkout-game-options__item,
.checkout-customer-options__item,
.checkout-open-rentals__item,
.waitlist-card,
.rental-history-card {
    background: var(--color-background);
    border-radius: var(--border-radius-tiny);
    padding: var(--padding-small);
    color: inherit;
}

.checkout-game-options__item,
.waitlist-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--padding-medium);
}

.checkout-customer-options__item:hover,
.checkout-open-rentals__item:hover,
.customer-rentals__item:hover {
    text-decoration: none;
    background: var(--color-detail);
}

.game-view-header {
    display: flex;
    justify-content: space-between;
    gap: var(--padding-medium);
    align-items: flex-start;
    flex-wrap: wrap;
}

.game-view-header__actions {
    display: flex;
    gap: var(--padding-small);
    flex-wrap: wrap;
    align-items: center;
}

.game-view-header__actions .button-wrapper {
    min-width: 170px;
}

.game-view-open-rental,
.checkin-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--padding-small) var(--padding-medium);
}

.game-view-open-rental .customer-identity,
.checkin-detail-grid .customer-identity {
    grid-column: 1 / -1;
}

.game-view-open-rental span,
.checkin-detail-grid span {
    font-weight: 700;
}

.game-view-open-rental__due,
.checkin-hero__due,
.customer-rentals__due,
.rental-history-card__due {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-tiny);
    padding: var(--padding-tiny) var(--padding-small);
    font-weight: 700;
    width: fit-content;
}

.is-overdue {
    color: var(--color-alert-safe);
    border: 1px solid var(--color-alert-safe);
}

.is-due-today {
    color: var(--color-warning-safe);
    border: 1px solid var(--color-warning-safe);
}

.is-due-later {
    color: var(--color-success-safe);
    border: 1px solid var(--color-success-safe);
}

.is-unknown {
    color: var(--color-detail-light);
    border: 1px solid var(--color-detail-light);
}

.waitlist-card__actions {
    display: flex;
    gap: var(--padding-small);
    flex-wrap: wrap;
}

.rental-history-card {
    display: flex;
    flex-direction: column;
    gap: var(--padding-small);
}

.rental-history-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--padding-small);
}

.rental-history-card__badge {
    background: var(--color-detail-light);
    color: var(--color-background-dark);
    border-radius: var(--border-radius-tiny);
    padding: var(--padding-tiny) var(--padding-small);
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
}

.rental-history-card__meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--padding-small) var(--padding-medium);
}

.rental-history-card__meta span {
    font-weight: 700;
}

.rental-history-card__notes {
    display: flex;
    flex-direction: column;
    gap: var(--padding-tiny);
}

.rental-history-card__notes-heading {
    display: flex;
    align-items: center;
    gap: var(--padding-tiny);
    flex-wrap: wrap;
}

.rental-history-card__notes-label {
    font-weight: 700;
    font-size: .9rem;
}

.rental-note-link {
    font-size: .9rem;
    font-weight: 700;
    text-decoration: underline;
}

.rental-note-display {
    background: var(--color-background-dark);
    border-radius: var(--border-radius-tiny);
    padding: var(--padding-small);
    line-height: 1.4;
}

.checkin-hero {
    display: flex;
    gap: var(--padding-medium);
    align-items: stretch;
}

.checkin-hero__thumb {
    width: 140px;
    min-width: 140px;
    border-radius: var(--border-radius-tiny);
    overflow: hidden;
    background: var(--color-background);
}

.checkin-hero__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.checkin-hero__content {
    display: flex;
    flex-direction: column;
    gap: var(--padding-small);
}

.gd-interest-form {
    position: relative;
    width: 100%;
    padding: 0;
    border-radius: 0;
    background: transparent;
    border: 0;
}

.gd-interest-form .form-component,
.gd-interest-form input {
    width: 100%;
}

.gd-interest-form .button-wrapper {
    width: 100%;
}

.gd-interest-form .button-wrapper > a,
.gd-interest-form .button-wrapper > button {
    width: 100%;
}

.gd-interest-form .g-recaptcha {
    flex-direction: row;
}

.gd-interest-trap {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.note--success {
    color: var(--color-success-safe);
    border: 1px solid var(--color-success-safe);
    border-radius: var(--border-radius-tiny);
    padding: var(--padding-tiny) var(--padding-small);
}

@media (max-width: 900px) {
    .admin-split-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 699px) {
    .gd-availability__status {
        width: 100%;
    }

    .gd-availability__actions {
        flex-direction: column;
    }

    .gd-availability__actions .button-wrapper {
        max-width: none;
        width: 100%;
    }

    #admin-nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: var(--padding-tiny);
        gap: var(--padding-tiny);
    }

    #admin-nav a {
        min-height: 44px;
        white-space: normal;
        text-align: center;
        line-height: 1.2;
        padding: var(--padding-small) var(--padding-tiny);
        font-size: .95rem;
    }

    .game-view-open-rental,
    .checkin-detail-grid,
    .rental-history-card__meta {
        grid-template-columns: 1fr;
    }

    .checkin-hero {
        flex-direction: column;
    }

    .checkin-hero__thumb {
        width: 100%;
        min-width: 0;
        aspect-ratio: 16 / 9;
    }

    .waitlist-card,
    .checkout-game-options__item {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 430px) {
    #admin-nav {
        grid-template-columns: 1fr;
    }
}
