@font-face { font-family: Oxanium; src: url('/static/fonts/oxanium.woff2') format('woff2'); font-style: normal; font-weight: 400 800; font-display: swap; }
@font-face { font-family: 'Space Grotesk'; src: url('/static/fonts/space-grotesk.woff2') format('woff2'); font-style: normal; font-weight: 400 700; font-display: swap; }

:root {
  color-scheme: dark;
  --base: #100e23;
  --panel: #191630;
  --raised: #27204a;
  --line: #4a3d72;
  --ink: #f7f3ff;
  --muted: #c4b8e0;
  --accent: #58f2ff;
  --accent-bg: #152f49;
  --pink: #ff72c5;
  --yellow: #ffe17a;
  --danger: #ffc0d8;
  --display: Oxanium, 'Trebuchet MS', sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', 'SFMono-Regular', Consolas, monospace;
  font-family: 'Space Grotesk', 'Trebuchet MS', sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: var(--base);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
body:has(.game-dialog[open]) { overflow: hidden; }
a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .48; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: var(--base); }

.wrap { width: min(88rem, 100% - 2 * clamp(1rem, 4vw, 3.5rem)); margin-inline: auto; }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link:focus { position: fixed; z-index: 2; top: .5rem; left: .5rem; background: var(--accent); color: var(--base); padding: .6rem; }
.icon-library { position: absolute; inline-size: 0; block-size: 0; overflow: hidden; }
.icon { inline-size: 1.25rem; block-size: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linejoin: round; stroke-linecap: round; }

.masthead { background: #17132d; border-bottom: 1px solid var(--line); }
.masthead::after { content: ''; display: block; height: 3px; background: linear-gradient(90deg, var(--pink) 0 18%, #8d76ff 18% 35%, var(--accent) 35% 76%, var(--yellow) 76% 100%); }
.masthead-inner, .account, .wordmark { display: flex; align-items: center; }
.masthead-inner { min-height: 4.75rem; justify-content: space-between; gap: 1rem; }
.wordmark { flex: none; gap: .75rem; color: var(--ink); font: 800 1.48rem/1.05 var(--display); text-decoration: none; letter-spacing: .03em; text-transform: uppercase; }
.wordmark small { display: block; margin-top: .34rem; color: var(--muted); font: .61rem/1.15 var(--mono); letter-spacing: .13em; text-transform: uppercase; }
.brand-stamp { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border: 1px solid var(--pink); background: #392148; color: var(--pink); border-radius: .25rem; box-shadow: 3px 3px 0 #7c428f; }
.brand-stamp .icon { width: 1.45rem; height: 1.45rem; }
.account { min-width: 0; gap: .8rem; }
.account-name { color: var(--muted); font-size: .8rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 16ch; }

.button, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 2.75rem; border: 1px solid transparent; border-radius: .3rem; text-decoration: none; line-height: 1.15; }
.button { padding: .48rem .85rem; font-size: .86rem; font-weight: 700; white-space: nowrap; }
.quiet { border-color: var(--line); background: var(--panel); color: var(--ink); }
.quiet:not(:disabled):hover, .icon-button:hover { background: var(--raised); border-color: var(--pink); color: var(--accent); }
.primary { color: #100e23; background: var(--accent); }
.primary:hover { background: var(--yellow); }
.icon-button { width: 2.75rem; padding: 0; color: var(--muted); background: transparent; }

.catalog { padding-block: clamp(1.65rem, 4vw, 3.25rem) 3rem; }
.catalog-heading { display: flex; align-items: end; justify-content: space-between; gap: 1.4rem; margin-bottom: 1.65rem; }
.eyebrow { margin: 0 0 .5rem; color: var(--pink); font: 700 .75rem/1.4 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3 { margin: 0; }
h1 { color: var(--accent); font: 800 clamp(2.5rem, 5vw, 4rem)/1 var(--display); letter-spacing: -.025em; text-shadow: 3px 3px 0 #561953; }
.search { width: min(100%, 25rem); min-height: 3rem; display: flex; align-items: center; gap: .55rem; border: 1px solid var(--line); border-radius: .3rem; background: var(--panel); padding: 0 .25rem 0 .8rem; }
.search:focus-within { border-color: var(--accent); }
.search > .icon { color: var(--accent); }
.search input { flex: 1; min-width: 0; min-height: 2.75rem; color: var(--ink); border: 0; background: none; outline: 0; padding: .3rem .4rem .3rem 0; }
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { appearance: none; }

.systems { border-block: 1px solid var(--line); }
.system-list { display: flex; flex-wrap: wrap; gap: .42rem .55rem; padding: .65rem .25rem; margin-inline: -.25rem; }
.system-button { display: inline-flex; align-items: center; gap: .48rem; min-height: 2.75rem; border: 1px solid var(--line); border-radius: .3rem; background: var(--panel); color: var(--ink); padding: .35rem .68rem; max-width: 100%; text-align: left; font-size: .83rem; }
.system-icon { display: block; width: 1.85rem; height: 1.45rem; flex: none; }
.system-button:hover { border-color: var(--pink); }
.system-button[aria-pressed='true'] { color: var(--accent); background: var(--accent-bg); border-color: var(--accent); }

.system-count { font: .67rem/1 var(--mono); color: var(--muted); }
.system-error { padding-bottom: .65rem; color: var(--muted); font-size: .86rem; }
.system-error button { margin-inline-start: .5rem; }

.results-header { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; padding-block: 1.45rem 1rem; }
.results-header h2 { font: 700 clamp(1.28rem, 2vw, 1.65rem)/1.15 var(--display); overflow-wrap: anywhere; }
.result-count, .page-label { margin: 0; color: var(--muted); font: .75rem/1.4 var(--mono); white-space: nowrap; }
.game-grid, .screenshot-grid { list-style: none; display: grid; margin: 0; padding: 0; }
.game-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.15rem), 1fr)); gap: clamp(.65rem, 1.55vw, 1.35rem); }
.game-grid > li { min-width: 0; }
.game-card { display: block; width: 100%; padding: 0; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: .38rem; text-align: left; overflow: hidden; }
.game-card:hover, .game-card:focus-visible { border-color: var(--pink); }
.game-card:hover .game-title, .game-card:focus-visible .game-title { color: var(--accent); }
.cover { display: block; position: relative; isolation: isolate; width: 100%; aspect-ratio: 3 / 4; overflow: hidden; background: #141127; }
.cover-placeholder { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: .55rem; background: repeating-linear-gradient(135deg, #2a2248 0 1px, transparent 1px 10px); color: var(--muted); font: .61rem/1.2 var(--mono); text-align: center; }
.cover-placeholder .icon { color: var(--pink); width: 2.5rem; height: 2.5rem; stroke-width: 1.05; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #141127; }
.game-labels { display: block; padding: .62rem .66rem .72rem; border-top: 1px solid var(--line); }
.game-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; height: 2.7em; overflow: hidden; overflow-wrap: anywhere; font-size: .9rem; font-weight: 700; line-height: 1.35; }
.game-system { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: .28rem; color: var(--muted); font: .64rem/1.2 var(--mono); }
.state { padding: 1.7rem 1.35rem; border: 1px dashed var(--line); border-radius: .35rem; color: var(--muted); background: var(--panel); }
.state-title { margin: 0; color: var(--ink); font: 700 1.25rem/1.3 var(--display); }
.state-copy { margin: .45rem 0 0; line-height: 1.5; }
.state .button { margin-top: .9rem; }
.pagination { display: flex; align-items: center; justify-content: center; gap: clamp(.45rem, 2vw, 1.3rem); padding-top: 1.6rem; }

.game-dialog { width: min(53rem, 100% - 2rem); max-width: none; max-height: calc(100% - 2rem); max-height: calc(100dvh - 2rem); overflow: auto; overscroll-behavior: contain; margin: auto; padding: 0; border: 1px solid var(--pink); border-radius: .45rem; background: var(--panel); color: var(--ink); box-shadow: 0 1rem 4rem #0009; }
.game-dialog::backdrop { background: #090619d6; }
.detail-header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .35rem clamp(.85rem, 3vw, 1.6rem); border-bottom: 1px solid var(--line); background: #231937; }
.detail-header .eyebrow { margin: 0; }
.detail-body { padding: clamp(1rem, 3vw, 1.6rem); }
.detail-layout { display: grid; grid-template-columns: minmax(0, 10.5rem) 1fr; align-items: start; gap: clamp(1rem, 4vw, 2rem); }
.detail-layout .cover { border: 1px solid var(--line); border-radius: .3rem; }
.detail-info { min-width: 0; }
.detail-title { font: 700 clamp(1.75rem, 4vw, 2.7rem)/1.09 var(--display); overflow-wrap: anywhere; text-wrap: pretty; }
.metadata { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 1rem; margin: .95rem 0 1.15rem; }
.metadata-wide { grid-column: 1 / -1; }
.download-options { display: flex; flex-wrap: wrap; gap: .5rem; }
.download-options .download { min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.metadata dt { color: var(--muted); font: .69rem/1.2 var(--mono); letter-spacing: .065em; text-transform: uppercase; }
.metadata dd { margin: .23rem 0 0; font-size: .91rem; line-height: 1.4; overflow-wrap: anywhere; }
.description, .screenshots { margin-top: 1.45rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.detail-body h3 { font: 700 1.3rem/1.2 var(--display); }
.description p, .detail-state { margin: .65rem 0 0; color: var(--muted); line-height: 1.62; overflow-wrap: anywhere; }
.description p { white-space: pre-wrap; }
.detail-state + .button { margin-top: .85rem; }
.screenshot-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr)); gap: .65rem; margin-top: .75rem; }
.screenshot-link, .screenshot-fallback { display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 10; overflow: hidden; border: 1px solid var(--line); border-radius: .25rem; background: var(--base); color: var(--muted); }
.screenshot-link:hover { border-color: var(--accent); }
.screenshot-link img { width: 100%; height: 100%; object-fit: contain; min-height: 0; min-width: 0; }
.screenshot-fallback { align-content: center; gap: .45rem; font-size: .75rem; }

.login-main { padding-block: clamp(2rem, 9vw, 6rem); }
.login-panel { width: min(100%, 28rem); margin-inline: auto; padding: clamp(1.2rem, 5vw, 2.4rem); background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--pink); border-radius: .4rem; box-shadow: 5px 5px 0 #30224c; }
.login-form { display: grid; gap: .5rem; margin-top: 1.7rem; }
.login-form label { color: var(--muted); font-size: .85rem; }
.login-form input:not([type='hidden']) { min-height: 2.85rem; min-width: 0; padding: .55rem .7rem; background: var(--base); color: var(--ink); border: 1px solid var(--line); border-radius: .3rem; margin-bottom: .5rem; }
.login-form .button { margin-top: .25rem; }
.login-error { color: var(--danger); border: 1px solid #a44d7c; background: #402039; padding: .65rem .75rem; line-height: 1.45; overflow-wrap: anywhere; }

@media (max-width: 42rem) {
  .catalog-heading { display: grid; gap: 1rem; margin-bottom: 1.25rem; }
  .search { width: 100%; }
  .system-list { flex-wrap: nowrap; overflow-x: auto; scrollbar-color: #8874bb var(--base); scrollbar-width: thin; }
  .system-button { flex: 0 0 auto; white-space: nowrap; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 7.55rem), 1fr)); }
  .detail-layout { grid-template-columns: minmax(0, 7rem) 1fr; }
}
@media (max-width: 28rem) {
  .account-name { display: none; }
  .game-dialog { width: calc(100% - 1rem); max-height: calc(100% - 1rem); max-height: calc(100dvh - 1rem); }
  .detail-layout { grid-template-columns: minmax(0, 5rem) 1fr; gap: .75rem; }
  .metadata { grid-template-columns: 1fr; gap: .55rem; }
  .pagination .button { gap: .2rem; padding-inline: .45rem; }
  .pagination .icon { width: 1rem; }
}
