:root {
    color-scheme: dark;
    --bg: #0e0f16;
    --surface: #171923;
    --surface-2: #202331;
    --text: #f6f7fb;
    --muted: #a7abba;
    --line: #2c3040;
    --accent: #7c6cf2;
    --accent-strong: #9488ff;
    --danger: #ef6262;
    --success: #39b980;
    --radius: 16px;
    --content: 1480px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-width: 320px;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.6 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.sr-only, .skip-link:not(:focus) {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.skip-link:focus { position: fixed; z-index: 100; top: 12px; left: 12px; padding: 10px 14px; background: white; color: black; border-radius: 8px; }

.site-header {
    position: sticky;
    z-index: 20;
    top: 0;
    background: rgba(14, 15, 22, .9);
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    backdrop-filter: blur(18px);
}
.header-inner, .footer-inner {
    width: min(calc(100% - 40px), var(--content));
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
}
.header-inner { min-height: 72px; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; font-weight: 800; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 10px; background: linear-gradient(145deg, var(--accent-strong), #4d45c2); box-shadow: 0 7px 22px rgba(108, 92, 231, .32); }
.site-nav, .site-footer nav { display: flex; align-items: center; gap: 24px; }
.site-nav a, .site-footer a { color: var(--muted); text-decoration: none; font-size: .92rem; font-weight: 650; }
.site-nav a:hover, .site-nav a:focus-visible, .site-footer a:hover { color: var(--text); }

.catalog-shell, .game-detail, .content-page {
    width: min(calc(100% - 40px), var(--content));
    margin: 0 auto;
}
.catalog-shell { padding: 40px 0 80px; }
.catalog-heading { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin-bottom: 28px; }
.catalog-heading h1 { font-family: "Avenir Next", Avenir, "SF Pro Display", Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: clamp(1.65rem, 3vw, 2.75rem); font-weight: 700; line-height: 1.12; letter-spacing: -.035em; }
.eyebrow { margin: 0 0 4px; color: var(--accent-strong); font-size: .75rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.7rem); line-height: 1.08; letter-spacing: -.045em; }
h2 { letter-spacing: -.025em; }
.search-box { width: min(100%, 460px); height: 48px; display: flex; align-items: center; gap: 11px; padding: 0 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 108, 242, .16); }
.search-box svg { width: 20px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); }
.search-box input::placeholder { color: #777c8d; }

.category-filter { display: flex; gap: 9px; padding-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.category-filter::-webkit-scrollbar { display: none; }
.category-filter button { flex: 0 0 auto; min-height: 40px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); cursor: pointer; }
.category-filter button:hover, .category-filter button:focus-visible { border-color: #53586e; color: var(--text); }
.category-filter button.is-active { border-color: var(--accent); background: var(--accent); color: white; }
.game-section { margin-top: 40px; scroll-margin-top: 90px; }
.section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.section-title h2 { margin: 0; font-size: 1.35rem; }
.section-title span { display: inline-grid; place-items: center; min-width: 27px; height: 27px; padding: 0 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .78rem; font-weight: 700; }
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px 14px; }
.game-card { min-width: 0; }
.game-card a { display: block; text-decoration: none; }
.game-card-image { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: var(--radius); background: var(--surface-2); box-shadow: 0 7px 24px rgba(0, 0, 0, .15); }
.game-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s ease, filter .2s ease; }
.game-card h3 { margin: 9px 4px 0; font-size: .93rem; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-card a:hover img, .game-card a:focus-visible img { transform: scale(1.045); filter: brightness(1.07); }
.game-card a:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: var(--radius); }
.new-badge { position: absolute; top: 9px; left: 9px; padding: 4px 8px; border-radius: 7px; background: #f6d64a; color: #17150b; font-size: .68rem; line-height: 1; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; box-shadow: 0 3px 10px rgba(0, 0, 0, .25); }
.new-badge.static { position: static; display: inline-block; box-shadow: none; }
.no-results, .empty-state { color: var(--muted); }
.empty-state { margin-top: 50px; padding: 70px 24px; text-align: center; border: 1px dashed var(--line); border-radius: 22px; background: rgba(23, 25, 35, .45); }
.empty-state h2 { margin: 14px 0 4px; color: var(--text); }
.empty-state p { margin: 0; }
.empty-icon { width: 52px; height: 52px; display: grid; place-items: center; margin: 0 auto; border-radius: 16px; background: var(--surface-2); color: var(--accent-strong); font-size: 2rem; }

.game-detail { padding: 32px 0 88px; }
.back-link { display: inline-block; margin-bottom: 28px; color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--text); }
.game-hero { display: flex; align-items: center; gap: 28px; margin-bottom: 32px; }
.game-icon { width: 150px; height: 150px; flex: 0 0 auto; border-radius: 32px; object-fit: cover; box-shadow: 0 18px 46px rgba(0, 0, 0, .3); }
.game-intro { max-width: 840px; }
.game-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.game-meta a { color: var(--accent-strong); font-weight: 700; text-decoration: none; }
.lead { margin: 12px 0 0; max-width: 760px; color: var(--muted); font-size: 1.08rem; }
.store-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.store-button { display: flex; flex-direction: column; justify-content: center; min-width: 176px; min-height: 58px; padding: 9px 18px; border: 1px solid transparent; border-radius: 12px; color: white; text-decoration: none; font-size: .69rem; line-height: 1.15; box-shadow: 0 10px 26px rgba(0, 0, 0, .24); transition: transform .18s ease, filter .18s ease, box-shadow .18s ease; }
.store-button-ios { border-color: #fff; background: linear-gradient(145deg, #fff, #dfe4ee); color: #12141b; }
.store-button-android { border-color: #45bd87; background: linear-gradient(145deg, #24956a, #146444); color: #fff; }
.store-button strong { font-size: 1.08rem; }
.store-button:hover, .store-button:focus-visible { filter: brightness(1.06); transform: translateY(-2px); box-shadow: 0 14px 30px rgba(0, 0, 0, .3); }
.store-button:focus-visible { outline: 3px solid var(--accent-strong); outline-offset: 3px; }
.game-cover { width: 100%; max-height: 720px; object-fit: cover; border-radius: 24px; background: var(--surface); }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 50px; margin-top: 42px; }
.prose { color: #c9ccda; }
.prose h1, .prose h2, .prose h3 { color: var(--text); }
.prose h2 { margin: 1.7em 0 .45em; font-size: 1.35rem; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { max-width: 78ch; }
.prose a { color: var(--accent-strong); }
.tag-panel { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); align-self: start; }
.tag-panel h2 { margin: 0 0 12px; font-size: 1rem; }
.tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tags span { padding: 5px 9px; border-radius: 7px; background: var(--surface-2); color: var(--muted); font-size: .78rem; }
.screenshots { margin-top: 54px; }
.screenshots h2 { font-size: 1.35rem; }
.screenshot-track { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; scroll-snap-type: x proximity; }
.screenshot-track img { flex: 0 0 auto; width: auto; height: min(58vw, 460px); border-radius: 18px; object-fit: cover; scroll-snap-align: start; background: var(--surface); }
.more-games { margin-top: 56px; }

.content-page { min-height: 62vh; padding: 72px 0 100px; }
.content-page > p { max-width: 720px; color: var(--muted); }
.contact-email { display: inline-block; margin-top: 12px; color: var(--accent-strong); font-size: clamp(1.2rem, 3vw, 1.8rem); font-weight: 750; text-decoration: none; }
.legal-content { width: min(calc(100% - 40px), 860px); }
.legal-content > h1 { margin-bottom: 24px; }
.error-page .primary-button { margin-top: 18px; }
.primary-button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; padding: 10px 17px; border-radius: 10px; background: var(--accent); color: white; font-weight: 700; text-decoration: none; }

.site-footer { border-top: 1px solid var(--line); color: var(--muted); }
.footer-inner { min-height: 90px; }
.site-footer p { margin: 0; font-size: .88rem; }

@media (min-width: 1200px) {
    .game-grid { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 22px 16px; }
}
@media (max-width: 760px) {
    .header-inner, .footer-inner, .catalog-shell, .game-detail, .content-page { width: min(calc(100% - 28px), var(--content)); }
    .header-inner { min-height: 64px; }
    .brand > span:last-child { display: none; }
    .site-nav { gap: 14px; }
    .site-nav a { font-size: .82rem; }
    .catalog-shell { padding-top: 28px; }
    .catalog-heading { align-items: stretch; flex-direction: column; gap: 20px; }
    .search-box { width: 100%; }
    .game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 10px; }
    .game-card-image { border-radius: 13px; }
    .game-card h3 { margin-top: 7px; font-size: .84rem; }
    .new-badge { top: 7px; left: 7px; }
    .game-hero { align-items: flex-start; gap: 18px; }
    .game-icon { width: 100px; height: 100px; border-radius: 23px; }
    .detail-layout { grid-template-columns: 1fr; gap: 25px; }
    .game-cover { border-radius: 17px; }
    .footer-inner { padding: 22px 0; align-items: flex-start; flex-direction: column; gap: 10px; }
}
@media (max-width: 430px) {
    .site-nav a:nth-last-child(2) { display: none; }
    .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px 11px; }
    .game-hero { display: grid; grid-template-columns: 84px 1fr; }
    .game-icon { width: 84px; height: 84px; border-radius: 20px; }
    .game-intro { display: contents; }
    .game-intro h1, .game-intro .lead, .game-intro .store-links { grid-column: 1 / -1; }
    .game-intro h1 { margin-top: 4px; }
    .store-links { flex-direction: column; }
    .store-button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; }
}
