* { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
    font-family: var(--body-font, 'Segoe UI'), system-ui, sans-serif;
    color: var(--ink);
    background: var(--bg);
    color-scheme: var(--color-scheme, light);
    font-size: 16px;
}

body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
p { margin: 0; }
h1, h2 { font-family: var(--heading-font, inherit); margin: 0; line-height: 1.06; }
h1 { letter-spacing: -.045em; }
h2 { letter-spacing: -.035em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.wrap { width: min(100% - 64px, var(--width, 1240px)); margin-inline: auto; }
.skip-link { position: absolute; z-index: 4; padding: 12px 16px; background: var(--surface); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

#site-header { min-height: 68px; }
.site-header { background: var(--header); color: var(--header-ink, var(--ink)); border-bottom: var(--edge, 1px) solid var(--header-line, var(--line)); }
.header-inner { width: min(100% - 64px, var(--width, 1240px)); min-height: 67px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.brand { display: inline-flex; align-items: center; flex: none; }
.brand img { display: block; width: 145px; height: auto; }
.desktop-categories { display: flex; align-items: center; flex-wrap: wrap; gap: clamp(12px, 2.1vw, 30px); justify-content: flex-end; }
.desktop-categories a { display: inline-flex; align-items: center; min-height: 43px; font-size: .87rem; font-weight: 700; white-space: nowrap; }
.desktop-categories a:hover, .desktop-categories a[aria-current] { text-decoration: underline; text-underline-offset: .34em; }
.category-toggle { display: none; border: 1px solid currentColor; border-radius: var(--button-radius); background: transparent; font-size: .88rem; font-weight: 750; padding: 10px 13px; }
.category-toggle span { margin-left: 5px; }
#category-dialog { width: min(100% - 32px, 430px); max-height: calc(100% - 32px); color: var(--ink); background: var(--surface); padding: 20px; border: 1px solid var(--line); border-radius: var(--panel-radius); }
#category-dialog::backdrop { background: rgb(0 0 0 / .58); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.dialog-heading h2 { font-size: 1.35rem; }
.dialog-heading button { border: 1px solid var(--line); background: var(--bg); border-radius: 50%; height: 42px; width: 42px; font-size: 1.5rem; line-height: 1; }
.dialog-categories { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.dialog-categories a { background: var(--bg); border-radius: var(--card-radius); border: 1px solid var(--line); padding: 13px 12px; font-weight: 700; }
.dialog-categories a:hover, .dialog-categories a[aria-current] { text-decoration: underline; }

.site-footer { margin-top: 56px; background: var(--header); color: var(--header-ink, var(--ink)); border-top: var(--edge, 1px) solid var(--header-line, var(--line)); }
.footer-inner { width: min(100% - 64px, var(--width, 1240px)); margin: auto; display: flex; justify-content: space-between; align-items: flex-start; gap: 20px 40px; padding-block: 32px; }
.footer-inner p { margin-top: 4px; font-size: .88rem; }
.footer-inner nav { display: flex; flex-wrap: wrap; gap: 12px 22px; }
.footer-inner nav a { font-size: .9rem; text-decoration: underline; text-underline-offset: .2em; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: .65rem; width: fit-content; padding: 12px 17px; min-height: 44px; color: var(--button-ink); background: var(--accent); border: var(--edge, 1px) solid var(--accent); border-radius: var(--button-radius); font-size: .92rem; font-weight: 800; line-height: 1.2; }
.button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.section-link, .back-link { font-size: .9rem; font-weight: 750; text-decoration: underline; text-underline-offset: .24em; white-space: nowrap; }
.tile-grid { display: grid; gap: 14px; }
.game-card { min-width: 0; display: flex; flex-direction: column; border: var(--edge, 1px) solid var(--line); border-radius: var(--card-radius); overflow: hidden; background: var(--surface); transition: box-shadow .16s ease, border-color .16s ease; }
.game-card:hover { border-color: var(--focus); box-shadow: 0 4px 15px var(--shadow); }
.game-card img { width: 100%; aspect-ratio: var(--tile-ratio, 4 / 3); object-fit: cover; object-position: center; background: var(--line); }
.card-caption { display: flex; flex: 1; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; padding: 10px 11px; font-size: .87rem; line-height: 1.28; overflow-wrap: anywhere; }
.listing, .player, .prose { padding-top: clamp(26px, 5vw, 60px); }
.page-heading { margin-bottom: 24px; }
.page-heading h1, .prose h1 { font-size: clamp(2rem, 5vw, 4rem); overflow-wrap: anywhere; }
.page-heading p, .load-status { color: var(--muted); margin-top: .7rem; }
.detail-cover { aspect-ratio: 1; object-fit: contain; border-radius: var(--card-radius); background: var(--bg); }
.back-link { display: inline-block; margin-bottom: 12px; }
.game-frame { border: var(--edge, 1px) solid var(--line); border-radius: var(--panel-radius); overflow: hidden; background: var(--surface); }
.game-frame iframe { display: block; border: 0; width: 100% !important; height: clamp(350px, 74svh, 850px) !important; }
.prose { width: min(100% - 64px, 970px); }
.prose article { padding: clamp(18px, 4.5vw, 58px); border: var(--edge, 1px) solid var(--line); background: var(--surface); border-radius: var(--panel-radius); line-height: 1.65; overflow-wrap: anywhere; }
.prose h2 { margin-top: 1.65em; font-size: clamp(1.26rem, 3vw, 1.65rem); }
.prose p { margin: 1em 0; max-width: 74ch; }
.prose a:not(.button) { color: var(--link, var(--ink)); font-weight: 650; text-decoration: underline; text-underline-offset: .18em; }
.prose ul { padding-left: 1.35em; }
.prose li + li { margin-top: .5em; }
.page-date { color: var(--muted); font-size: .9rem; }

@media (max-width: 880px) {
    .header-inner, .wrap, .footer-inner, .prose { width: calc(100% - 44px); }
    .desktop-categories { display: none; }
    .category-toggle { display: inline-flex; align-items: center; }
}
@media (max-width: 600px) {
    .header-inner, .wrap, .footer-inner, .prose { width: calc(100% - 32px); }
    .header-inner { gap: 10px; }
    .brand img { width: 128px; }
    .footer-inner { flex-direction: column; }
    .tile-grid { gap: 10px; }
    .card-caption { padding: 8px; font-size: .81rem; }
    .section-link { font-size: .8rem; }
}
@media (prefers-reduced-motion: reduce) {
    .game-card { transition: none; }
}
