@font-face {
    font-family: "Barlow Condensed";
    src: url("./fonts/barlow-condensed-800.woff2") format("woff2");
    font-weight: 800;
    font-display: swap;
}

@font-face {
    font-family: "DM Sans";
    src: url("./fonts/dm-sans.woff2") format("woff2");
    font-weight: 400 700;
    font-display: swap;
}

:root {
    color-scheme: dark;
    --display-font: "Barlow Condensed", "Arial Narrow", sans-serif;
    --body-font: "DM Sans", sans-serif;
    --background: #151a21;
    --panel: #1c242e;
    --control: #222a34;
    --edge: #3d4958;
    --text: #f4f3ed;
    --muted: #b4bfcb;
    --yellow: #f9d961;
    --yellow-hover: #ffe88f;
    --viewport: #11151a;
    --shell: 1240px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-width: 0;
    background: var(--background);
    color: var(--text);
    font: 400 1rem/1.55 var(--body-font);
}

body:has(dialog[open]) { overflow: hidden; }

a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }
button[hidden], [hidden] { display: none; }

:focus-visible {
    outline: 2px solid var(--yellow);
    outline-offset: 4px;
}

h1, h2, h3, p, figure { margin: 0; }

.sr-only, .skip-link:not(:focus) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.skip-link:focus {
    position: fixed;
    z-index: 1;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.6rem 0.85rem;
    background: var(--yellow);
    color: var(--background);
}

.shell {
    width: min(100%, var(--shell));
    margin-inline: auto;
    padding-inline: clamp(1rem, 4vw, 2.5rem);
}

.site-header {
    border-bottom: 1px solid var(--edge);
}

.header-inner,
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
}

.header-inner { min-height: 68px; }

.wordmark {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    font: 800 1.47rem/1 var(--display-font);
    letter-spacing: 0.035em;
    text-decoration: none;
    text-transform: uppercase;
}

.wordmark-suffix { color: var(--muted); }

.arcade-mark {
    position: relative;
    flex: none;
    width: 27px;
    height: 27px;
    color: var(--yellow);
    background:
        linear-gradient(currentColor, currentColor) 0 100% / 6px 21px,
        linear-gradient(currentColor, currentColor) 7px 4px / 6px 10px,
        linear-gradient(currentColor, currentColor) 14px 4px / 6px 10px,
        linear-gradient(currentColor, currentColor) 21px 100% / 6px 21px;
    background-repeat: no-repeat;
}

.browse-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 44px;
    color: var(--muted);
    font-size: 0.87rem;
    font-weight: 700;
    text-decoration: none;
}

.browse-link span, .browse-link:hover { color: var(--yellow); }

.feature {
    position: relative;
    display: grid;
    grid-template-columns: minmax(245px, 0.85fr) minmax(0, 1.4fr);
    align-items: center;
    gap: clamp(1.25rem, 4vw, 3rem);
    margin-block-start: clamp(1.25rem, 4vw, 2.65rem);
    padding: clamp(1.2rem, 3.5vw, 2.65rem);
    border: 1px solid var(--edge);
    border-radius: 18px 18px 18px 4px;
    background-color: var(--panel);
    background-image: radial-gradient(#323d4a 1px, transparent 1px);
    background-size: 11px 11px;
}

.feature-copy { min-width: 0; }

.eyebrow {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--yellow);
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.eyebrow::before {
    width: 7px;
    height: 7px;
    background: currentColor;
    content: "";
}

.feature h1 {
    margin-block: 0.15rem 0.55rem;
    font: 800 clamp(4.35rem, 8vw, 7.5rem)/0.89 var(--display-font);
    letter-spacing: -0.022em;
    text-transform: uppercase;
}

.feature-description {
    max-width: 27ch;
    color: var(--muted);
}

.play-button {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.2rem;
    min-height: 49px;
    padding: 0.62rem 0.95rem;
    margin-block-start: 1.3rem;
    border: 1px solid var(--yellow);
    border-radius: 5px;
    background: var(--yellow);
    color: var(--background);
    font-weight: 700;
    text-decoration: none;
    transition: background-color 150ms, transform 150ms;
}

.play-button:hover { background-color: var(--yellow-hover); }
.play-button:active { transform: translateY(2px); }
.play-button span { font-size: 1.28em; }

.feature-screen {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    padding: 6px;
    background: var(--viewport);
    border: 1px solid #5a6978;
    border-radius: 11px 11px 4px 4px;
    box-shadow: 0 8px var(--viewport);
}

.feature-screen img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 5px 5px 2px 2px;
    object-fit: cover;
}

.file-notice {
    margin-top: 1.5rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--edge);
    border-inline-start: 3px solid var(--yellow);
    border-radius: 4px;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.file-notice code,
.file-notice a { color: var(--text); }

.library {
    margin-block: clamp(2.25rem, 5vw, 3.25rem) 4rem;
    scroll-margin-top: 1rem;
}

.library-heading,
.library-title {
    display: flex;
    align-items: baseline;
    gap: 0.55rem 0.85rem;
    flex-wrap: wrap;
}

.library-heading { justify-content: space-between; }

.library-title h2 {
    font: 800 clamp(2.3rem, 4vw, 3.1rem)/1 var(--display-font);
    text-transform: uppercase;
}

#game-count {
    color: var(--muted);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

.game-search {
    width: min(100%, 19rem);
    position: relative;
}

.game-search::before,
.game-search::after {
    position: absolute;
    top: 14px;
    left: 15px;
    content: "";
    pointer-events: none;
}

.game-search::before {
    width: 10px;
    height: 10px;
    border: 1.6px solid var(--muted);
    border-radius: 50%;
}

.game-search::after {
    top: 26px;
    left: 25px;
    width: 7px;
    height: 1.6px;
    background: var(--muted);
    transform: rotate(45deg);
    transform-origin: left center;
}

.game-search input {
    width: 100%;
    min-height: 44px;
    padding: 0.5rem 0.75rem 0.5rem 2.55rem;
    border: 1px solid var(--edge);
    border-radius: 6px;
    background: var(--control);
    color: var(--text);
    font-size: 1.025rem;
}

.game-search input::placeholder { color: var(--muted); }

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-block: 1rem 1.1rem;
}

.filter,
.secondary-button,
.close-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--edge);
    border-radius: 5px;
    background: var(--control);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    transition: background-color 150ms, border-color 150ms;
}

.filter { color: var(--muted); }

.filter:hover,
.secondary-button:hover,
.close-button:hover {
    border-color: var(--muted);
    color: var(--text);
}

.filter[aria-pressed="true"] {
    border-color: var(--yellow);
    background: var(--yellow);
    color: var(--background);
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
}

.game-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--edge);
    border-radius: 9px 9px 9px 4px;
    background: var(--panel);
    text-decoration: none;
    transition: border-color 150ms, transform 150ms;
}

.game-card:hover {
    transform: translateY(-2px);
    border-color: var(--yellow);
}

.game-card img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: var(--viewport);
    border-bottom: 1px solid var(--edge);
}

.game-card-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.35rem;
    flex: 1;
    padding: 0.7rem 0.8rem 0.8rem;
}

.game-card-title {
    font-size: 0.99rem;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.game-card-category {
    margin-top: 0.15rem;
    color: var(--muted);
    font-size: 0.78rem;
}

.game-card-arrow {
    color: var(--yellow);
    font-size: 1.12rem;
    line-height: 1;
}

.empty-state {
    padding: 1.25rem;
    border: 1px solid var(--edge);
    border-radius: 6px;
}

.empty-state p {
    color: var(--muted);
    margin-bottom: 0.65rem;
}

.site-footer { border-top: 1px solid var(--edge); }

.footer-inner {
    flex-wrap: wrap;
    min-height: 70px;
    padding-block: 1.1rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.footer-inner a { text-underline-offset: 0.17em; }
.footer-inner a:hover { color: var(--text); }

.game-player {
    width: min(1120px, calc(100vw - 28px));
    max-width: none;
    max-height: calc(100dvh - 24px);
    padding: 0;
    overflow: auto;
    border: 1px solid var(--edge);
    border-radius: 12px;
    background: var(--panel);
    color: var(--text);
}

.game-player::backdrop { background: rgb(10 13 17 / 84%); }

.player-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem 1rem;
    padding: 0.7rem 0.9rem;
}

.player-info { min-width: 0; }

.player-info h2 {
    font: 800 1.75rem/1.07 var(--display-font);
    overflow-wrap: anywhere;
}

.player-info p {
    margin-top: 0.2rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.player-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.close-button {
    width: 44px;
    padding: 0;
    font-size: 1.65rem;
    line-height: 1;
}

.game-viewport {
    position: relative;
    width: 100%;
    height: min(650px, 75dvh, 67vw);
    background: var(--viewport);
}

.game-viewport:fullscreen { height: 100%; }

.game-viewport iframe {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 0;
    opacity: 0;
}

.game-viewport iframe.is-ready { opacity: 1; }

.game-loading {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
    color: var(--muted);
}

.game-loading[hidden] { display: none; }

@media (max-width: 890px) {
    .game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 650px) {
    .header-inner { min-height: 58px; }
    .wordmark { font-size: 1.26rem; }
    .feature { grid-template-columns: 1fr; }
    .feature h1 { font-size: clamp(3.9rem, 14vw, 6rem); }
    .feature-description { max-width: none; }
    .feature-screen { margin-bottom: 0.28rem; }
    .game-search { width: 100%; }
    .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .player-bar { align-items: start; flex-direction: column; }
    .game-viewport { height: min(64dvh, 108vw); }
    .game-viewport.landscape-game:not(:fullscreen) { height: calc((100vw - 30px) * 0.5625); }
}

@media (max-height: 450px) and (orientation: landscape) {
    .game-viewport:not(:fullscreen) { height: min(67vw, calc(100dvh - 112px)); }
}

@media (max-width: 365px) {
    .wordmark-suffix { display: none; }
    .game-card-body { padding-inline: 0.55rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}
