/* ===== Global Styles ===== */
:root {
    --bg-deep: #0a0a0c;
    --bg-mid: #121214;
    --surface: rgba(255, 255, 255, 0.055);
    --surface-hover: rgba(255, 255, 255, 0.09);
    --border-subtle: rgba(255, 255, 255, 0.1);
    --accent: #7c9cff;
    --accent-soft: rgba(124, 156, 255, 0.22);
    --text: #f2f2f4;
    --text-muted: rgba(255, 255, 255, 0.62);
    --radius-lg: 22px;
    --radius-md: 14px;
    --font-sans: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Roboto", "Helvetica Neue", Arial, sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg-deep);
    background-image:
        radial-gradient(ellipse 120% 80% at 50% -20%, rgba(124, 156, 255, 0.12), transparent 55%),
        radial-gradient(ellipse 60% 50% at 100% 50%, rgba(99, 102, 241, 0.06), transparent 45%);
    color: var(--text);
    margin: 0;
    padding: 0;
    text-align: center;
    min-height: 100vh;
    font-size: 18px;
    -webkit-font-smoothing: antialiased;
}

body.home-page {
    --sidebar-collapsed: 76px;
    --sidebar-expanded: 250px;
    --home-content-offset: calc(var(--sidebar-collapsed) / 2);
    overflow-x: hidden;
}

.home-page .page-shell {
    min-height: 100vh;
}

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

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
    outline: none;
}

.stats-page .page-shell,
.settings-page .page-shell {
    min-height: 100vh;
    padding-left: var(--sidebar-collapsed);
}

.home-page .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-collapsed);
    height: 100vh;
    padding: 88px 12px 18px;
    box-sizing: border-box;
    background: linear-gradient(180deg, #1a1a1a 0%, #0a0a0a 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    z-index: 1100;
    transition: width 0.32s ease, box-shadow 0.32s ease;
}

.home-page .sidebar:hover {
    width: var(--sidebar-expanded);
    box-shadow: 18px 0 40px rgba(0, 0, 0, 0.28);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-divider {
    height: 1px;
    margin: 10px 4px;
    background: rgba(255, 255, 255, 0.12);
}

.sidebar-link {
    width: 100%;
    border: none;
    border-radius: 14px;
    background: transparent;
    color: #c8c8c8;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.22s ease, color 0.22s ease, transform 0.22s ease;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.sidebar-link:hover {
    transform: translateX(2px);
}

.sidebar-icon {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    top: -1px;
}

.sidebar-icon svg {
    width: 22px;
    height: 22px;
    display: block;
    fill: currentColor;
}

#navFavourites .sidebar-icon svg {
    width: 24px;
    height: 24px;
}

.sidebar-label {
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.home-page .sidebar:hover .sidebar-label,
body.game-page .sidebar:hover .sidebar-label {
    opacity: 1;
    transform: translateX(0);
}

/* ===== Top Bar ===== */
.topbar {
    --topbar-search-width: min(58%, 640px);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px; /* Full width, fixed height */
    background: rgba(22, 22, 26, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 0 2.5%; /* responsive side padding */
    box-sizing: border-box;
    z-index: 1000;
}

.home-page .topbar {
    left: 0;
    width: 100%;
    z-index: 1200;
}

.stats-main,
.settings-main {
    min-height: 100vh;
    padding: 120px 48px 56px;
    box-sizing: border-box;
}

.secondary-page-hero {
    max-width: 1120px;
    margin: 0 auto 32px;
    text-align: left;
}

.stats-hero {
    max-width: 1120px;
    margin: 0 auto 28px;
    text-align: left;
}

.stats-kicker,
.secondary-page-kicker {
    margin: 0 0 10px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.stats-hero h1,
.secondary-page-hero h1 {
    margin: 0;
    font-size: clamp(2.2rem, 3.6vw, 3.25rem);
    line-height: 1.08;
    color: #fff;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.stats-hero p,
.secondary-page-hero p {
    margin: 14px 0 0;
    max-width: 640px;
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.65;
}

.stats-panel {
    max-width: 1120px;
    margin: 0 auto;
}

.stats-list {
    display: grid;
    gap: 14px;
}

.stats-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
    align-items: center;
    padding: 24px 28px;
    border-radius: var(--radius-lg);
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    text-align: left;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    transition: border-color 0.2s ease, background 0.2s ease;
}

.stats-row:hover {
    border-color: rgba(255, 255, 255, 0.16);
    background: var(--surface-hover);
}

.stats-row-label {
    color: #f0f0f0;
    font-size: 1.15rem;
    font-weight: 800;
}

.stats-row-copy {
    margin-top: 6px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.98rem;
    line-height: 1.5;
}

.stats-row-value {
    color: #d0d0d0;
    font-size: clamp(1.08rem, 1.8vw, 1.62rem);
    font-weight: 900;
    text-align: right;
    white-space: nowrap;
}

.settings-panel {
    max-width: 1120px;
    margin: 0 auto;
}

.settings-list {
    display: grid;
    gap: 14px;
}

.settings-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
    align-items: center;
    padding: 24px 28px;
    border-radius: var(--radius-lg);
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    text-align: left;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    transition: border-color 0.2s ease, background 0.2s ease;
}

.settings-row:hover {
    border-color: rgba(255, 255, 255, 0.16);
    background: var(--surface-hover);
}

.settings-row.is-danger {
    border-color: rgba(248, 113, 113, 0.35);
    background: rgba(248, 113, 113, 0.06);
}

.settings-row.is-danger:hover {
    border-color: rgba(248, 113, 113, 0.45);
}

.settings-row-label {
    color: #f4f4f5;
    font-size: 1.12rem;
    font-weight: 800;
}

.settings-row-desc {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    font-weight: 500;
}

.settings-action-btn {
    padding: 12px 22px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #f0f0f0;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.settings-action-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.28);
    transform: scale(1.02);
}

.settings-row.is-danger .settings-action-btn {
    border-color: rgba(248, 113, 113, 0.45);
    background: rgba(248, 113, 113, 0.12);
    color: #fecaca;
}

.settings-row.is-danger .settings-action-btn:hover {
    background: rgba(248, 113, 113, 0.22);
    color: #fff;
}

/* Title */
.topbar .title {
    font-size: 1.85rem;
    color: #e8e8e8;
    font-weight: bold;
}

.topbar .home-title {
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
}

.topbar-logo-btn {
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.topbar-logo {
    width: 58px;
    height: 58px;
    object-fit: contain;
    flex-shrink: 0;
    position: relative;
    top: 2px;
    margin-left: -62px;
    margin-right: -10px;
}

.topbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1.85rem;
    font-weight: 800;
    color: #f5f5f5;
    text-decoration: none;
    flex-shrink: 0;
    letter-spacing: 0.02em;
    line-height: 1.1;
}

.topbar-brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.22);
    box-sizing: border-box;
}

.topbar-brand:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* Search Bar */
.topbar #searchBar {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: var(--topbar-search-width);
    margin: 0;
    padding: 11px 16px;
    font-size: 17px;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.35);
    color: #e8e8e8;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.topbar #searchBar:hover {
    border-color: rgba(255, 255, 255, 0.16);
}

.topbar #searchBar:focus {
    border-color: var(--accent-soft);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.topbar #searchBar::placeholder {
    color: #e8e8e8;
    opacity: 1;
}

.games-sort-wrap {
    justify-self: end;
    margin-right: 74px;
    display: flex;
    align-items: center;
    position: relative;
    padding: 0 6px;
    border-radius: 8px;
    background: #2e2e2e;
}

#sortSelect {
    padding: 10px 12px;
    padding-right: 34px;
    min-width: 120px;
    font-size: 18px;
    line-height: 1;
    border: none;
    background: transparent;
    background-image: none;
    color: #e8e8e8;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    text-align: center;
    text-align-last: center;
}

.games-sort-wrap::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 14px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #e8e8e8;
    transform: translateY(-35%);
    pointer-events: none;
}

/* Random Button */
.topbar #requestGameBtn,
.topbar #topbarDisguiseBtn,
.topbar #randomBtn {
    padding: 10px 22px;
    font-size: 18px;
    font-weight: 700;
    border-radius: 8px;
    border: none;
    background: #2e2e2e;
    color: #e8e8e8;
    cursor: pointer;
    transition: transform 0.2s;
    flex-shrink: 0;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.topbar #requestGameBtn {
    position: absolute;
    left: calc(75% + (var(--topbar-search-width) / 4) - 127px);
    transform: translateX(-50%);
}

.topbar #topbarDisguiseBtn {
    position: absolute;
    left: calc(75% + (var(--topbar-search-width) / 4) + 65px);
    transform: translateX(-50%);
}

.topbar #requestGameBtn:hover,
.topbar #topbarDisguiseBtn:hover,
.topbar #randomBtn:hover {
    transform: translateX(-50%) scale(1.05); /* only zoom */
}

/* ===== Recently Played ===== */
.recently-played {
    display: none;
    padding: 90px 20px 10px 20px;
}

.recently-played h2 {
    margin: 0 0 16px 0;
    font-size: 1.6rem;
    color: #e8e8e8;
    text-align: center;
}

.all-games h2 {
    margin: 0 0 16px 0;
    font-family: inherit;
    font-size: 1.6rem;
    font-weight: 700;
    color: #e8e8e8;
    text-align: center;
}

.all-games {
    padding: 100px 20px 0 20px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    column-gap: 16px;
}

body.home-page.recent-page:not(.favourites-page) .all-games {
    padding-top: 100px;
}

body.home-page.recent-page:not(.favourites-page) .all-games + .games {
    padding-top: 8px;
}

body.home-page.favourites-page .all-games {
    padding-top: 110px;
}

body.home-page.favourites-page .all-games + .games {
    padding-top: 16px;
}

.all-games h2 {
    grid-column: 2;
    margin: 0;
    line-height: 1;
    align-self: center;
}

.all-games .games-sort-wrap {
    margin-right: 0;
}

.all-games-actions {
    grid-column: 3;
    align-self: center;
    justify-self: end;
    margin-right: 66px;
    display: flex;
    align-items: center;
    gap: 12px;
}

#disguiseTabBtn {
    padding: 10px 18px;
    font-size: 18px;
    font-weight: 400;
    border-radius: 8px;
    border: none;
    background: #2e2e2e;
    color: #e8e8e8;
    cursor: pointer;
    transition: transform 0.2s;
}

#clearRecentsBtn {
    padding: 10px 18px;
    font-size: 18px;
    font-weight: 400;
    border-radius: 8px;
    border: none;
    background: #2e2e2e;
    color: #e8e8e8;
    cursor: pointer;
    transition: transform 0.2s;
}

#disguiseTabBtn:hover,
#clearRecentsBtn:hover {
    transform: scale(1.05);
}

.has-recent .all-games {
    padding-top: 40px;
}

.recent-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 25px;
    max-width: calc((138px * 8) + (25px * 7));
    margin: 0 auto;
}

.recent-row .game {
    width: 138px;
    height: 138px;
}

.has-recent .recently-played {
    display: block;
}

.is-searching .recently-played {

    display: none;
}

.is-searching .all-games {
    padding-top: 100px;
}

.is-searching .all-games .games-sort-wrap {
    display: none;
}

.is-searching #disguiseTabBtn,
.is-searching #clearRecentsBtn {
    display: none;
}

.is-searching .all-games + .games {
    padding-top: 24px;
}

.has-recent .games {
    padding-top: 40px;
}

/* ===== Adjust Games Grid for Topbar ===== */
.games {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 25px;
    padding: 4px 20px 24px 20px;
    max-width: calc((138px * 8) + (25px * 7));
    margin: 0 auto;
}

body.home-page:not(.recent-page) .games {
    justify-content: flex-start;
}

body.home-page:not(.recent-page) .recent-row {
    justify-content: flex-start;
}

.home-page .recently-played,
.home-page .all-games,
.home-page .games,
.home-page .no-results {
    transition: max-width 0.32s ease;
}

body.home-page:not(.recent-page) .all-games,
body.home-page:not(.recent-page) .games,
body.home-page:not(.recent-page) .no-results {
    position: relative;
    left: var(--home-content-offset);
}

body.home-page:not(.recent-page) .recently-played {
    position: relative;
    left: var(--home-content-offset);
}

body.recent-page .all-games,
body.recent-page .games,
body.recent-page .no-results {
    position: relative;
    left: 34px;
}

.all-games + .games {
    padding-top: 10px;
}

.no-results {
    display: none;
    padding: 100px 20px 20px;
}

.no-results-text {
    margin: 0 0 20px;
    color: #e8e8e8;
    font-size: 1.6rem;
    font-weight: bold;
}

.recent-empty-copy {
    margin: 0;
    color: #c8c8c8;
    font-size: 1.05rem;
}

.request-game-btn {
    display: inline-block;
    margin: 0 0 34px;
    padding: 12px 20px;
    border-radius: 10px;
    background: #2e2e2e;
    color: #e8e8e8;
    text-decoration: none;
    font-weight: bold;
    transition: transform 0.2s;
}

.request-game-btn:hover {
    transform: scale(1.05);
}

.no-results-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 25px;
    max-width: calc((138px * 8) + (25px * 7));
    margin: 0 auto;
}

/* ===== Individual Game Cards ===== */
.game {
    text-decoration: none;
    color: #fff;
    background: linear-gradient(165deg, #2a2a2e 0%, #1c1c20 100%);
    padding: 0;
    border-radius: var(--radius-md);
    width: 138px;
    height: 138px;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.game:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
    border-color: rgba(255, 255, 255, 0.14);
}

.favorite-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: #9a9a9a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 3;
    opacity: 0;
    transition: color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.favorite-toggle:hover {
    transform: scale(1.08);
}

.game:hover .favorite-toggle,
body.game-page .recommendation-card:hover .favorite-toggle {
    opacity: 1;
}

.favorite-toggle svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
    display: block;
    filter: drop-shadow(0 0 1px rgba(0, 0, 0, 1)) drop-shadow(0 0 3px rgba(0, 0, 0, 1)) drop-shadow(0 0 5px rgba(0, 0, 0, 0.95));
}

.favorite-toggle.is-favorite {
    color: #ffffff;
}

.favorite-toggle.favorite-pop {
    animation: favorite-pop 0.22s ease-out;
}

@keyframes favorite-pop {
    0% {
        transform: scale(1);
    }
    55% {
        transform: scale(1.28);
    }
    100% {
        transform: scale(1);
    }
}

/* ===== Game Images ===== */
/* Logo cards */
.game.has-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.game.has-logo p {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 1.1rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.game.has-logo:hover p {
    opacity: 1;
}

/* Game Titles */
.game p {
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    color: #e8e8e8;
    text-align: center;
    padding: 0 8px;
    line-height: 1.25;
}

.recent-page .games {
    display: none;
    grid-template-columns: repeat(8, 138px);
    justify-content: center;
    padding-top: 18px;
}

.recent-page .no-results {
    padding-top: 28px;
}

/* ===== Responsive ===== */
@media (max-width: 800px) {
    body.home-page {
        --sidebar-collapsed: 68px;
        --sidebar-expanded: 214px;
    }

    .topbar { --topbar-search-width: min(52%, 520px); }
    .topbar #searchBar { font-size: 16px; }
    .game { width: 110px; height: 110px; }
    .games { max-width: calc((110px * 6) + (25px * 5)); }
    .recent-row .game { width: 110px; height: 110px; }
    .recent-row { max-width: calc((110px * 6) + (25px * 5)); }
    .no-results-grid { max-width: calc((110px * 5) + (25px * 4)); }
    .stats-main,
    .settings-main { padding: 110px 28px 36px; }
    .stats-row { padding: 22px; }
    .settings-row { padding: 22px; }
    body.game-page .sidebar {
        width: 68px;
    }
    body.game-page .page {
        margin-left: 68px;
    }
}

@media (max-width: 500px) {
    body.home-page {
        --sidebar-collapsed: 0px;
        --sidebar-expanded: 0px;
    }

    .home-page .sidebar {
        display: none;
    }

    .home-page .page-shell {
        padding-left: 0;
    }

    .stats-page .page-shell,
    .settings-page .page-shell {
        padding-left: 0;
    }

    .home-page .topbar {
        left: 0;
        width: 100%;
    }

    .topbar {
        flex-direction: column;
        height: auto;
        padding: 10px;
    }
    .topbar #searchBar {
        position: static;
        transform: none;
        width: 90%;
        margin: 10px 0;
    }
    body.game-page .topbar-request,
    .topbar #requestGameBtn,
    .topbar #topbarDisguiseBtn {
        position: static;
        left: auto;
        transform: none;
        margin: 10px 0;
        width: 80%;
    }
    .topbar #randomBtn { margin: 10px 0; width: 80%; }
    .no-results-grid { max-width: calc((110px * 3) + (25px * 2)); }
    body.game-page .sidebar {
        display: none;
    }
    body.game-page .page {
        margin-left: 0;
    }

    .all-games {
        grid-template-columns: 1fr;
        row-gap: 12px;
    }

    .all-games h2,
    .all-games .all-games-actions {
        grid-column: auto;
        justify-self: center;
    }

    .all-games-actions {
        flex-direction: column;
    }

    #sortSelect {
        width: 100%;
        min-width: 180px;
    }

    .stats-main,
    .settings-main {
        padding: 104px 18px 26px;
    }

    .stats-row,
    .settings-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stats-row-value {
        text-align: left;
        white-space: normal;
    }
}

/* ===== Game Pages ===== */
body.game-page {
    min-height: 100%;
    background: var(--bg-deep);
    background-image:
        radial-gradient(ellipse 100% 70% at 50% -15%, rgba(124, 156, 255, 0.1), transparent 50%),
        radial-gradient(ellipse 50% 40% at 0% 80%, rgba(99, 102, 241, 0.05), transparent 45%);
    color: var(--text);
    display: flex;
    justify-content: center;
    padding: 94px 16px 48px;
    box-sizing: border-box;
}

body.game-page .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 76px;
    height: 100vh;
    padding: 88px 12px 18px;
    box-sizing: border-box;
    background: linear-gradient(180deg, #1a1a1a 0%, #0a0a0a 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    z-index: 1100;
    transition: width 0.32s ease, box-shadow 0.32s ease;
}

body.game-page .sidebar:hover {
    width: 250px;
    box-shadow: 18px 0 40px rgba(0, 0, 0, 0.28);
}

body.game-page .page {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    margin-left: 76px;
}

body.game-page .topbar,
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: rgba(22, 22, 26, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 0 5%;
    box-sizing: border-box;
    z-index: 1000;
}

body.game-page .topbar {
    z-index: 1200;
}

body.game-page .topbar-brand,
body.game-page .topbar-title,
.topbar .title,
.topbar .home-title {
    padding: 0;
    margin-left: 0;
    border: none;
    background: transparent;
    color: #e8e8e8;
    font-size: 1.85rem;
    font-weight: bold;
    cursor: pointer;
}

body.game-page .topbar-search,
.topbar #searchBar {
    position: absolute;
    left: 45%;
    transform: translateX(-50%);
    width: var(--topbar-search-width);
    margin: 0;
    padding: 11px 16px;
    font-size: 17px;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.35);
    color: #e8e8e8;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body.game-page .topbar-search:hover {
    border-color: rgba(255, 255, 255, 0.16);
}

body.game-page .topbar-search:focus {
    border-color: var(--accent-soft);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

body.game-page .topbar-search::placeholder,
.topbar #searchBar::placeholder {
    color: #e8e8e8;
    opacity: 1;
}

body.game-page .topbar-request,
body.game-page .topbar-random,
.topbar #requestGameBtn,
.topbar #topbarDisguiseBtn,
.topbar #randomBtn {
    padding: 10px 22px;
    font-size: 18px;
    font-weight: 700;
    border-radius: 8px;
    border: none;
    background: #2e2e2e;
    color: #e8e8e8;
    cursor: pointer;
    transition: transform 0.2s;
    flex-shrink: 0;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

body.game-page .topbar-request,
.topbar #requestGameBtn {
    position: absolute;
    left: calc(75% + (var(--topbar-search-width) / 4) - 127px);
    transform: translateX(-50%);
}

.topbar #topbarDisguiseBtn {
    position: absolute;
    left: calc(75% + (var(--topbar-search-width) / 4) + 65px);
    transform: translateX(-50%);
}

body.game-page .topbar-request:hover,
.topbar #requestGameBtn:hover,
.topbar #topbarDisguiseBtn:hover,
.topbar #randomBtn:hover {
    transform: translateX(-50%) scale(1.05);
}

body.game-page .topbar-random {
    display: none;
}

body.game-page .player-meta {
    width: min(100%, 1000px);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    background: #141414;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-top: none;
    border-radius: 0 0 22px 22px;
    min-height: 68px;
    padding: 0 18px;
    box-sizing: border-box;
}

body.game-page .title {
    margin: 0;
    margin-right: auto;
    width: auto;
    text-align: left;
    font-size: clamp(1.15rem, 2vw, 1.45rem);
    padding-left: 8px;
    box-sizing: border-box;
    color: #e8e8e8;
}

body.game-page .player-meta > .title,
body.game-page .player-meta > .player-meta-favorite,
body.game-page .player-meta > .player-meta-random,
body.game-page .player-meta > .panic-btn,
body.game-page .player-meta > .fullscreen-btn {
    position: relative;
    top: -8px;
}

body.game-page .player-meta-favorite,
body.game-page .fullscreen-btn {
    padding: 10px 16px;
    min-width: 132px;
    border: none;
    border-radius: 999px;
    background: #2e2e2e;
    color: #e8e8e8;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

body.game-page .player-meta-favorite {
    margin-right: -8px;
}

body.game-page .player-meta-random {
    padding: 10px 16px;
    min-width: 132px;
    border: none;
    border-radius: 999px;
    background: #2e2e2e;
    color: #e8e8e8;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
    margin-right: -8px;
}

body.game-page .panic-btn {
    padding: 10px 16px;
    min-width: 132px;
    border: none;
    border-radius: 999px;
    background: #2e2e2e;
    color: #e8e8e8;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
    margin-left: 0;
    margin-right: -8px;
}

body.game-page .panic-btn:hover {
    transform: scale(1.05);
}

body.game-page .player-meta-random:hover {
    transform: scale(1.05);
}

body.game-page .player-meta-favorite:hover {
    transform: scale(1.05);
}

body.game-page .fullscreen-btn:hover {
    transform: scale(1.05);
}

body.game-page .recommendations {
    width: min(100%, 1215px);
    margin-top: 36px;
    text-align: center;
}

body.game-page .recommendations-heading {
    margin: 0 0 18px;
    font-size: 1.35rem;
    font-weight: 800;
    color: #f0f0f2;
    letter-spacing: -0.02em;
}

body.game-page .recommendations-sub {
    margin: -8px 0 22px;
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
}

body.game-page .recommendation-grid {
    display: grid;
    grid-template-columns: repeat(8, 130px);
    justify-content: center;
    gap: 25px;
    margin: 0 auto;
}

body.game-page .recommendation-card {
    text-decoration: none;
    color: #fff;
    background: linear-gradient(165deg, #2a2a2e 0%, #1c1c20 100%);
    border-radius: var(--radius-md);
    width: 130px;
    height: 130px;
    overflow: hidden;
    position: relative;
    display: block;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.3);
}

body.game-page .recommendation-card:hover {
    transform: scale(1.05) translateY(-2px);
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

body.game-page .recommendation-card .favorite-toggle {
    top: 7px;
    right: 7px;
    width: 36px;
    height: 36px;
}

body.game-page .recommendation-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

body.game-page .recommendation-card span {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 1.1rem;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s;
}

body.game-page .recommendation-card:hover span {
    opacity: 1;
}

body.game-page .player-shell {
    width: min(100%, 1000px);
    background: linear-gradient(180deg, #1a1a1f 0%, #121216 100%);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-bottom: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 18px 18px 14px;
    box-sizing: border-box;
    box-shadow: 0 28px 64px rgba(0, 0, 0, 0.42);
}

body.game-page .player-frame {
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 520px;
    border: none;
    border-radius: var(--radius-md);
    background: #000;
    display: block;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

body.game-page .player-shell:fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: none;
    padding: 0;
    border: none;
    border-radius: 0;
    background: #000;
    box-shadow: none;
}

body.game-page .player-shell:fullscreen .player-frame {
    width: 100%;
    height: 100%;
    min-height: 100vh;
    aspect-ratio: auto;
    border-radius: 0;
}

@media (max-width: 800px) {
    body.game-page {
        padding: 98px 12px 32px;
    }

    body.game-page .player-shell {
        padding: 12px;
        border-radius: 18px 18px 0 0;
    }

    body.game-page .player-frame {
        min-height: 360px;
    }

    body.game-page .player-meta {
        border-radius: 0 0 18px 18px;
        min-height: 60px;
        padding: 0 12px;
    }

    body.game-page .topbar-search {
        width: min(52%, 520px);
        font-size: 16px;
    }

    body.game-page .recommendation-grid {
        grid-template-columns: repeat(5, 104px);
    }

    body.game-page .recommendation-card {
        width: 104px;
        height: 104px;
    }
}

@media (max-width: 560px) {
    .topbar {
        flex-direction: column;
        height: auto;
        padding: 10px;
    }

    .topbar #searchBar {
        position: static;
        transform: none;
        width: 90%;
        margin: 10px 0;
    }

    .topbar #requestGameBtn,
    .topbar #topbarDisguiseBtn,
    .topbar #randomBtn {
        margin: 10px 0;
        width: 80%;
    }

    .topbar #requestGameBtn {
        margin-left: 0;
    }

    body.game-page {
        padding-top: 170px;
    }

    body.game-page .topbar {
        flex-direction: column;
        height: auto;
        padding: 10px;
    }

    body.game-page .topbar-search {
        position: static;
        transform: none;
        width: 90%;
        margin: 10px 0;
    }

    body.game-page .topbar-request,
    body.game-page .topbar-random {
        margin: 10px 0;
        width: 80%;
    }

    body.game-page .topbar-request {
        margin-left: 0;
    }

    body.game-page .player-frame {
        min-height: 240px;
    }

    body.game-page .player-meta {
        gap: 10px;
    }

    body.game-page .player-meta-favorite,
    body.game-page .fullscreen-btn {
        padding: 9px 14px;
        min-width: 118px;
        font-size: 0.9rem;
    }

    body.game-page .player-meta-favorite {
        margin-right: 2px;
    }

    body.game-page .panic-btn {
        padding: 9px 14px;
        min-width: 118px;
        font-size: 0.9rem;
        margin-left: 0;
        margin-right: 2px;
    }

    body.game-page .recommendations {
        margin-top: 24px;
    }

    body.game-page .recommendation-grid {
        grid-template-columns: repeat(3, 104px);
        gap: 18px;
    }
}
