:root {
    color: #182c3c;
    background: #edf1f5;
    font-family: "Inter", system-ui, sans-serif;
    line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: #204e73; }
:focus-visible { outline: 3px solid #1c6b97; outline-offset: 3px; }
img { max-width: 100%; height: auto; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: fixed; top: .5rem; left: .5rem; z-index: 2; padding: .75rem; background: white; }
.shell { max-width: 78rem; margin: auto; padding: 1rem; }
.header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem; background: white; border-radius: 12px; }
.header .brand { display: block; width: min(100%, 23rem); }
.header .brand img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 7 / 1;
    object-fit: cover;
    object-position: center 48%;
}
.header form { display: flex; flex: 0 1 26rem; min-width: 0; gap: .4rem; }
input, button { font: inherit; border-radius: 7px; }
input { flex: 1; width: 100%; min-width: 0; padding: .55rem .75rem; border: 1px solid #8294a3; color: inherit; background: white; }
button { border: 0; background: #255477; color: white; padding: .55rem .85rem; cursor: pointer; }
button:disabled { opacity: .7; cursor: wait; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; margin-top: 1rem; }
.layout:has(.sidebar) { grid-template-columns: 12rem minmax(0, 1fr); }
.sidebar, main { background: white; border-radius: 12px; padding: 1rem; }
main { min-width: 0; overflow-wrap: anywhere; }
.sidebar { align-self: start; }
.sidebar h2 { margin: 0 0 .5rem; font-size: 1rem; }
.sidebar a { display: flex; align-items: center; gap: .55rem; padding: .28rem .4rem; border-radius: 8px; text-decoration: none; }
.category-icon { display: grid; place-items: center; flex: 0 0 1.75rem; height: 1.75rem; border-radius: 7px; color: var(--icon-ink); background: var(--icon-tint); }
.sidebar a:hover, .sort a:hover { text-decoration: underline; }
.sidebar [aria-current], .sort [aria-current], .pagination [aria-current] { color: #173d5c; background: #dfedf8; font-weight: 700; }
h1 { margin: 0 0 .75rem; font-size: clamp(1.6rem, 4vw, 2.25rem); line-height: 1.15; }
.sort, .pagination { display: flex; flex-wrap: wrap; gap: .35rem; }
.sort a, .pagination > * { padding: .35rem .6rem; border-radius: 6px; }
.result-count { color: #4e5e69; }
/* Twelve tracks give four equal cards, with balanced short rows. */
main { container-type: inline-size; }
.cards { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); list-style: none; padding: 0; gap: .85rem; }
.cards > li { grid-column: span 3; min-width: 0; }
.cards a { height: 100%; }
.cards span { overflow-wrap: anywhere; }

/* For five remaining cards, use two on the penultimate row and three on the last. */
@container (width >= 38rem) {
    .cards > :first-child:nth-last-child(2), .cards > :first-child:nth-last-child(2) ~ li,
    .cards > :nth-child(4n+1):nth-last-child(5), .cards > :nth-child(4n+2):nth-last-child(4) {
        grid-column: span 6;
    }
    .cards > :first-child:nth-last-child(3), .cards > :first-child:nth-last-child(3) ~ li,
    .cards > :nth-child(4n+1):nth-last-child(3), .cards > :nth-child(4n+2):nth-last-child(2), .cards > :nth-child(4n+3):last-child,
    .cards > :nth-child(4n+3):nth-last-child(3), .cards > :nth-child(4n+4):nth-last-child(2), .cards > :nth-child(4n+1):not(:first-child):last-child {
        grid-column: span 4;
    }
}
@container (width < 38rem) {
    .cards > li { grid-column: span 6; }
    .cards > :nth-child(odd):nth-last-child(3),
    .cards > :nth-child(even):nth-last-child(2),
    .cards > :nth-child(odd):not(:first-child):last-child {
        grid-column: span 4;
    }
}
.cards > :only-child { grid-column: span 6; }
.cards a { display: block; border: 1px solid #d9e2ea; border-radius: 9px; overflow: hidden; text-decoration: none; font-weight: 650; }
.cards a:hover { border-color: #628eae; text-decoration: underline; }
.cards img { width: 100%; display: block; object-fit: cover; aspect-ratio: 4 / 3; background: #e5edf2; }
.cards span { display: block; padding: .65rem; }
.player { display: grid; place-items: center; align-content: center; gap: .65rem; min-height: 13rem; padding: 1rem; background: #e5edf2; border-radius: 9px; }
.player img { border-radius: 7px; }
.player p:empty { display: none; }
.player.playing { display: block; padding: 0; }
.player.playing > :not(ruffle-player) { display: none; }
ruffle-player { width: 100%; display: block; aspect-ratio: 4 / 3; }
.game-text { white-space: pre-line; }
.advertisement { margin-top: 1.25rem; max-width: 100%; overflow: clip; }
.adsbygoogle { display: block; }
footer { padding: 1rem .2rem; text-align: center; font-size: .9rem; }
@media (max-width: 43rem) {
    .shell { padding: .65rem; }
    .layout:has(.sidebar) { grid-template-columns: minmax(0, 1fr); }
    .sidebar { order: 1; }
    .sidebar nav { display: flex; flex-wrap: wrap; gap: .2rem; }
    .sidebar h2 { flex: 0 0 100%; }
}

