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

:root {
    --bg: #0b0b0d;
    --surface: #141417;
    --surface-alt: #1d1d21;
    --accent: #f5a623;
    --accent-fg: #000;
    --text: #e2e2e6;
    --text-muted: #7a7a82;
    --border: rgba(255, 255, 255, 0.07);
    --radius: 10px;
    --radius-sm: 6px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}


.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(11, 11, 13, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1340px;
    margin: 0 auto;
    padding: 0 22px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    position: relative;
}

.wordmark {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    transition: opacity 0.15s;
}

.wordmark:hover {
    opacity: 0.8;
}

.center-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.wordmark img {
    width: 26px;
    height: 26px;
    object-fit: contain;
    border-radius: 5px;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 22px;
}

.site-nav a {
    color: var(--text-muted);
    font-size: 14px;
    transition: color 0.15s;
}

.site-nav a:hover {
    color: var(--text);
}


main {
    max-width: 1340px;
    margin: 0 auto;
    padding: 36px 22px 80px;
}


.shelf {
    margin-bottom: 44px;
}

.shelf-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.shelf-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 14px;
    max-width: 900px;
}


.controls-bar {
    margin-bottom: 22px;
    text-align: center;
}

#search {
    display: block;
    width: 800px;
    margin: 0 auto;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 15px;
    outline: none;
    transition: border-color 0.15s;
    margin-bottom: 14px;
    -webkit-appearance: none;
    appearance: none;
}

#search:focus {
    border-color: var(--accent);
}

#search::placeholder {
    color: var(--text-muted);
}

#search::-webkit-search-cancel-button {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--text-muted);
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M1 1l10 10M11 1L1 11' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E");
    cursor: pointer;
}

.tag-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.tag-btn {
    padding: 5px 13px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-muted);
    font-size: 13px;
    transition: color 0.12s, border-color 0.12s, background 0.12s;
    line-height: 1;
}

.tag-btn:hover {
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.18);
}

.tag-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-fg);
    font-weight: 600;
}


.no-results {
    text-align: center;
    color: var(--text-muted);
    padding: 70px 0;
    font-size: 14px;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 18px;
}

.game-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 13px;
    width: 100%;
    transition: transform 0.18s;
}

.game-link img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: var(--radius);
    background: var(--surface);
    margin-bottom: 8px;
    transition: box-shadow 0.18s;
}

.game-link div {
    text-align: center;
    line-height: 1.3;
    transition: color 0.15s;
    max-width: 100%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.game-link:hover {
    transform: translateY(-4px);
}

.game-link:hover img {
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.65);
}

.game-link:hover div {
    color: var(--text);
}


.site-footer {
    border-top: 1px solid var(--border);
    text-align: center;
    padding: 22px 20px;
    color: var(--text-muted);
    font-size: 13px;
}

.site-footer a {
    color: var(--accent);
    transition: opacity 0.15s;
}

.site-footer a:hover {
    opacity: 0.8;
}


@media (max-width: 640px) {
    .header-inner {
        padding: 0 16px;
    }

    main {
        padding: 24px 16px 80px;
    }

    .game-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }

    .shelf-row {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

@keyframes rainbow-shift {
    from { filter: hue-rotate(0deg) saturate(1.5); }
    to   { filter: hue-rotate(360deg) saturate(1.5); }
}

.game-grid.rainbow-mode {
    animation: rainbow-shift 1.8s linear infinite;
}

@keyframes spin-once {
    0%   { transform: rotate(0deg) scale(1); }
    50%  { transform: rotate(360deg) scale(1.2); }
    100% { transform: rotate(720deg) scale(1); }
}

.wordmark img.spinning {
    animation: spin-once 0.7s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes fadepop {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
    20%  { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
    70%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
}

@media (max-width: 380px) {
    .game-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
}
