:root {
    --background: #131216;
    --nav: #201e25;
    --lighter: #1a191e;
    --accent: #555065;
    --button: #2b2833;
    --muted: #b5b5b5;
}

*, *::before, *::after { box-sizing: border-box; }

[x-cloak] { display: none !important; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: Inter, system-ui, sans-serif;
    background-color: var(--background);
    color: white;
}

body.no-scroll { overflow: hidden; }

[id] { scroll-margin-top: 80px; }

a { color: inherit; }

h1, h2, p { margin: 0; }

:focus-visible { outline: 2px solid #9d93c0; outline-offset: 2px; }

.grey { color: var(--muted); }
.icon { margin-right: 6px; }

/* ---------- nav ---------- */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    height: 60px;
    padding-inline: 5vw;
    display: flex;
    align-items: center;
    gap: 24px;
    background-color: var(--nav);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.nav-links {
    display: flex;
    gap: 4px;
    flex: 1;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 15px;
    text-decoration: none;
    color: var(--muted);
    transition: background-color 0.15s, color 0.15s;
}

.nav-links a:hover, .nav-links a.active { color: white; background-color: var(--button); }

.search { display: flex; border-radius: 100px; }

.search input, .search button {
    height: 36px;
    border: none;
    background-color: var(--background);
    color: white;
    font: inherit;
    font-size: 14px;
}

.search input {
    width: 220px;
    padding-left: 14px;
    border-radius: 100px 0 0 100px;
    -webkit-appearance: none;
    appearance: none;
}

.search input::placeholder { color: #6e6c77; }
.search input:focus { outline: none; }
.search:focus-within { box-shadow: 0 0 0 2px var(--accent); }

.search button {
    width: 50px;
    border-radius: 0 100px 100px 0;
    cursor: pointer;
}

.search button:hover { background-color: var(--button); }

/* ---------- layout ---------- */
.content { flex: 1; }

.main {
    margin-inline: 5vw;
    margin-block: 30px;
}

.main.narrow { max-width: 900px; }

.main > section + section { margin-top: 34px; }

.page-title {
    font-size: 32px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 28px;
}

.section-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 14px;
}

.section-title i { margin-right: 10px; color: var(--muted); }

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.see-all {
    color: var(--muted);
    font-size: 14px;
    text-decoration: none;
}

.see-all:hover { color: white; text-decoration: underline; }

.footer {
    padding: 24px;
    text-align: center;
    font-size: 13px;
    color: #6e6c77;
}

.state {
    min-height: 40vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-align: center;
}

.state h1 { font-size: 28px; font-weight: 600; }

.spinner {
    width: 34px;
    height: 34px;
    border: 3px solid var(--button);
    border-top-color: #9d93c0;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- buttons & tags ---------- */
.button {
    display: inline-block;
    color: white;
    background-color: var(--button);
    border: none;
    font: inherit;
    font-size: 16px;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.15s, background-color 0.15s;
}

.button:hover { transform: translateY(-2px); background-color: var(--accent); }

.tags-box {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.tag {
    color: white;
    text-decoration: none;
    background-color: var(--lighter);
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 15px;
    border: 2px var(--accent) solid;
    box-shadow: 0 0 10px #55506599;
    transition: background-color 0.2s, box-shadow 0.2s, transform 0.3s cubic-bezier(0.25, 1.25, 0.5, 1.05);
}

.tag:hover {
    background-color: var(--accent);
    box-shadow: 0 0 18px var(--accent);
    transform: scale(1.07);
}

/* ---------- game cards ---------- */
.games {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
}

.game {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 2 / 1;
    overflow: hidden;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), var(--nav));
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s;
}

.game:hover { transform: translateY(-4px); box-shadow: 0 8px 20px #0008; }

.game img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.game::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    transition: background-color 0.15s;
}

.game:hover::after { background: rgba(0, 0, 0, 0.1); }

.game-title {
    position: relative;
    z-index: 1;
    padding: 8px;
    max-width: 100%;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    text-shadow: 0 0 12px black, 0 0 9px black;
    overflow-wrap: anywhere;
}

/* ---------- search results ---------- */
.results { display: grid; gap: 14px; margin-top: 16px; }

.result {
    display: flex;
    gap: 14px;
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 0.15s;
}

.result:hover { background-color: var(--lighter); }

.result-thumb {
    flex: none;
    width: 200px;
    aspect-ratio: 2 / 1;
    border-radius: 6px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--accent), var(--nav));
}

.result-info { min-width: 0; padding-block: 4px; }
.result-title { font-size: 20px; font-weight: 600; margin-bottom: 4px; }

.result-desc {
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- game page ---------- */
.game-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 24px;
    align-items: start;
}

.player {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
}

.player iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.player:fullscreen { aspect-ratio: auto; border-radius: 0; }
.player:-webkit-full-screen { aspect-ratio: auto; border-radius: 0; }

.player.pseudo-fs {
    position: fixed;
    inset: 0;
    z-index: 10000;
    aspect-ratio: auto;
    border-radius: 0;
}

.fs-exit {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
    opacity: 0.7;
}

.fs-exit:hover { opacity: 1; }

.info-box {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-block: 14px 12px;
}

.info-box h1 { font-size: 24px; font-weight: 600; }

.description-box {
    display: grid;
    gap: 8px;
    background-color: var(--lighter);
    border-radius: 10px;
    padding: 14px;
    line-height: 1.5;
}

.related .games { grid-template-columns: 1fr 1fr; }
.related .game-title { font-size: 16px; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
    .game-layout { grid-template-columns: minmax(0, 1fr); }
    .related .games { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}

@media (max-width: 800px) {
    .nav { gap: 12px; }
    .nav-links { gap: 0; }
    .nav-links a { padding: 8px; }
    .nav-links a span { display: none; }
    .search input { width: 18vw; min-width: 90px; }
}

@media (max-width: 520px) {
    .brand span { display: none; }
    .page-title { font-size: 26px; }
    .games { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .game-title { font-size: 17px; }
    .result { flex-direction: column; gap: 6px; }
    .result-thumb { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition: none !important; animation-duration: 0.01ms !important; }
}
