/* Fonts are loaded via <link> in each page's <head> (faster than @import). */

* {
    font-family: "Exo 2", sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background: #151617;
    color: #fff;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #a88a45 transparent;
}

html::-webkit-scrollbar {
    width: 6px;
}

html::-webkit-scrollbar-track {
    background: transparent;
}

html::-webkit-scrollbar-thumb {
    background: #a88a45;
    border-radius: 3px;
}

html::-webkit-scrollbar-thumb:hover {
    background: #c9a84c;
}

body {
    padding: 0;
    margin: 0;
}

::selection {
    background: #a88a45;
    color: #000;
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #151617;
}

::-webkit-scrollbar-thumb {
    background: #2e2e2e;
}

::-webkit-scrollbar-thumb:hover {
    background: #343434;
}

nav {
    width: 100%;
    height: 3.5rem;
    text-transform: uppercase;
    font-size: 1.1rem;
    position: sticky;
    top: 0;
    z-index: 100000;
    max-width: 2000px;
    margin-left: auto;
    margin-right: auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    background: rgba(21, 22, 23, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: none;
}

nav .logo {
    margin-left: 0.69rem;
    height: auto;
    width: fit-content;
    text-decoration: none;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    white-space: nowrap;
    grid-column: 1;
    justify-self: start;
}

nav .links {
    display: flex;
    gap: 1rem;
    line-height: 1;
    align-items: center;
    grid-column: 2;
    justify-self: center;
}

nav .links a {
    text-decoration: none;
    color: #fff;
    transition: color 0.1s ease-in-out;
    font-size: 1.05rem;
}

nav .links a:hover {
    color: #d4d4d4;
}

nav .links a.active {
    color: #a88a45;
}

nav .links div {
    background: #888;
    width: 1px;
    height: 1rem;
}

nav .links .mobile-user-btn,
nav .links .mobile-login-btn {
    display: none;
}

nav .login-btn {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 1rem;
    width: fit-content;
    margin-left: auto;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #ccc;
}

nav .login-btn .discord-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Login button (logged out) */
nav .login-btn.login-open {
    background: rgba(168, 138, 69, 0.1);
    color: #c9a84c;
    padding: 0.38rem 1.1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid rgba(168, 138, 69, 0.35);
    cursor: pointer;
    font-family: "Exo 2", sans-serif;
    transition: all 0.15s ease;
}

nav .login-btn.login-open:hover {
    color: #dfc065;
    border-color: rgba(168, 138, 69, 0.6);
    background: rgba(168, 138, 69, 0.18);
    transform: translateY(-1px);
    box-shadow: 0 2px 12px rgba(168, 138, 69, 0.15);
}

/* Login modal */
.login-modal {
    position: fixed;
    inset: 0;
    z-index: 300000;
    display: none;
    align-items: center;
    justify-content: center;
}
.login-modal.show { display: flex; }

.login-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.login-modal-box {
    position: relative;
    background: #0e0e0e;
    border: 1px solid #1e1e1e;
    border-radius: 4px;
    padding: 2.5rem 2.5rem 2rem;
    width: 420px;
    max-width: 90vw;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    animation: loginModalIn 0.2s ease;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

@keyframes loginModalIn {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.login-modal-title {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-align: center;
    color: #fff;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.login-modal-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.55rem 1rem;
    border-radius: 4px;
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid #1a1a1a;
    transition: all 0.15s ease;
    font-family: "Exo 2", sans-serif;
    color: #ccc;
    background: #0a0a0a;
}

.login-modal-btn:hover {
    background: #141414;
    border-color: #2a2a2a;
    color: #fff;
}

.login-modal-btn svg {
    flex-shrink: 0;
}

.login-modal-discord .discord-icon {
    fill: #fff;
}

/* User avatar (logged in) */
nav .login-btn.user-avatar-btn {
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
}

.user-avatar-only {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #555;
    transition: all 0.15s ease;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

.user-avatar-only:hover {
    border-color: #999;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}

/* User popup menu */
.user-menu-wrap {
    position: relative;
}

.user-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: #1a1a1c;
    border: 1px solid #2c2c2e;
    border-radius: 8px;
    min-width: 190px;
    padding: 0.5rem;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
    z-index: 300000;
    animation: menuIn 0.12s ease;
}

.user-menu.show {
    display: block;
}

.user-menu-overlay {
    display: none;
}

@keyframes menuIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.user-menu-header {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.6rem 0.4rem;
}

.user-menu-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.user-menu-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #fff;
}

.user-menu-sep {
    display: none;
}

.user-menu-item {
    display: flex;
    align-items: center;
    padding: 0.45rem 0.6rem;
    font-size: 0.82rem;
    color: #ccc;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.1s ease;
    border: none;
    background: none;
    width: 100%;
    font-family: "Exo 2", sans-serif;
    border-radius: 4px;
}

.user-menu-item:hover {
    background: #252527;
    color: #fff;
}

.user-menu-item svg {
    display: none;
}

.user-menu-logout {
    color: #d4b65a;
}

.user-menu-logout:hover {
    background: rgba(201, 168, 76, 0.1);
    color: #e0c46a;
}

nav #nav-auth {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    grid-column: 3;
    justify-self: end;
    margin-right: 1rem;
}

/* Toggle icon: three plain lines */
nav .toggle-mnu {
    display: none;
    width: 36px;
    height: 36px;
    cursor: pointer;
    z-index: 200001;
    background: none;
    border: none;
    border-radius: 0;
    position: relative;
    padding: 0;
    margin-right: 0.25rem;
}

nav .toggle-mnu span {
    display: block;
    position: absolute;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
    left: 50%;
    transform: translateX(-50%);
}

nav .toggle-mnu span:nth-child(1) {
    top: 10px;
}

nav .toggle-mnu span:nth-child(2) {
    top: 17px;
}

nav .toggle-mnu span:nth-child(3) {
    top: 24px;
}

/* Scroll lock when mobile nav is open */
html:has(.links.active) {
    overflow: hidden;
}

html:has(.links.active) body {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    touch-action: none;
    overscroll-behavior: none;
}

@media (max-width: 768px) {
    nav {
        grid-template-columns: auto 1fr auto auto;
        padding: 0 0.5rem;
    }

    nav .logo {
        font-size: 1rem;
        margin-left: 0.5rem;
        grid-column: 1;
        z-index: 200001;
    }

    nav #nav-auth {
        display: flex;
        grid-column: 3;
        margin-right: 0.5rem;
        z-index: 200001;
    }

    /* Full-screen overlay nav */
    nav .links {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100dvh;
        background: rgba(10, 10, 11, 0.97);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        gap: 0;
        padding: 5rem 2rem 2rem;
        border: none;
        border-radius: 0;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 200000;
        grid-column: unset;
        justify-self: unset;
        align-items: center;
        justify-content: center;
        overflow-y: auto;
        transform: none;
        box-shadow: none;
    }

    nav .links.active {
        opacity: 1;
        pointer-events: auto;
    }

    nav .links a {
        padding: 1rem 0;
        font-size: 1.4rem;
        font-weight: 600;
        letter-spacing: 0.06em;
        transition: all 0.2s ease;
        position: relative;
        overflow: hidden;
        text-align: center;
        width: 100%;
        max-width: 300px;
        color: #999;
    }

    nav .links a::before {
        content: '';
        position: absolute;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%) scaleX(0);
        width: 40px;
        height: 2px;
        background: #c9a84c;
        border-radius: 2px;
        transition: transform 0.2s ease;
    }

    nav .links a:hover,
    nav .links a.active {
        color: #fff;
    }

    nav .links a.active::before {
        transform: translateX(-50%) scaleX(1);
    }

    nav .links a:hover {
        background: transparent;
        padding-left: 0;
    }

    nav .links div {
        width: 60px;
        height: 1px;
        background: #2a2a2a;
        margin: 0.75rem auto;
    }

    /* Mobile auth inside fullscreen menu */
    nav .links .mobile-login-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 0.85rem 2rem;
        font-size: 1rem;
        color: #c9a84c;
        text-decoration: none;
        cursor: pointer;
        background: rgba(168, 138, 69, 0.1);
        border: 1px solid rgba(168, 138, 69, 0.35);
        border-radius: 10px;
        margin-top: 2rem;
        width: 100%;
        max-width: 220px;
        text-align: center;
        font-family: inherit;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        font-weight: 600;
        transition: all 0.2s ease;
        position: relative;
        overflow: hidden;
    }

    nav .links .mobile-login-btn::before {
        display: none;
    }

    nav .links .mobile-login-btn:hover {
        color: #dfc065;
        border-color: rgba(168, 138, 69, 0.6);
        background: rgba(168, 138, 69, 0.18);
    }

    nav .links .mobile-user-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.3rem;
        padding: 0.75rem 1.5rem;
        text-decoration: none;
        cursor: pointer;
        margin-top: 1.5rem;
        background: transparent;
        border: none;
        border-radius: 0;
        width: auto;
        max-width: none;
        font-family: inherit;
        text-transform: none;
        transition: opacity 0.2s ease;
        position: relative;
        overflow: visible;
    }

    nav .links .mobile-user-btn::before {
        display: none;
    }

    nav .links .mobile-user-btn:hover {
        background: transparent;
        opacity: 0.85;
    }

    nav .links .mobile-user-btn img {
        width: 52px;
        height: 52px;
        border-radius: 50%;
        border: 2px solid rgba(168, 138, 69, 0.5);
        box-shadow: 0 0 20px rgba(168, 138, 69, 0.15);
        object-fit: cover;
        flex-shrink: 0;
        margin-bottom: 0.15rem;
    }

    nav .links .mobile-user-btn .user-name {
        font-weight: 700;
        font-size: 0.95rem;
        color: #fff;
        text-align: center;
    }

    nav .links .mobile-user-btn .user-action {
        font-size: 0.72rem;
        color: #a88a45;
        font-weight: 500;
        text-transform: none;
        letter-spacing: 0.04em;
    }

    nav .login-btn {
        margin-right: 0;
    }

    nav .login-btn.login-open {
        padding: 0.3rem 0.8rem;
        font-size: 0.78rem;
    }

    .user-avatar-only {
        width: 32px;
        height: 32px;
    }

    nav .links .mobile-login-btn,
    nav .links .mobile-user-btn {
        display: none !important;
    }

    .user-menu {
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        min-width: 140px;
        padding: 0.3rem;
        max-width: calc(100vw - 2rem);
    }

    .user-menu-name {
        font-size: 0.75rem;
    }

    .user-menu-item {
        font-size: 0.75rem;
        padding: 0.35rem 0.5rem;
    }

    nav .toggle-mnu {
        display: flex;
        grid-column: 4;
    }

    main {
        margin-top: 2rem;
        padding: 0 1rem;
        width: 100%;
    }

    main > #text {
        padding-inline: 0;
        margin-bottom: 2.5rem;
        text-align: center;
    }

    main > #text > span:first-child {
        font-size: 1.8rem;
        line-height: 1.2;
        display: block;
        margin-bottom: 0.75rem;
    }

    main > #text > span:last-child {
        font-size: 1rem;
        line-height: 1.6;
        display: block;
        color: #bbb;
    }

    main > #t_home,
    main > #t_skins {
        max-width: 100%;
        padding-inline: 0;
        transform: translateX(0) !important;
        margin-top: 1.5rem;
        text-align: center;
    }

    main > #t_home {
        padding-left: 0;
    }

    main > #t_skins {
        padding-right: 0;
        margin-top: 2.5rem;
    }

    main > #buttons {
        flex-direction: column;
        width: 100%;
        gap: 0.75rem;
        margin-top: 2rem;
    }

    main > #buttons > #search {
        display: none;
    }

    main > #buttons > #add {
        width: 100%;
        padding: 0.7rem 1rem;
        font-size: 1rem;
    }

    #recently-viewed {
        display: none;
    }

    .recent-profile {
        padding: 0.7rem 0;
    }

    footer {
        padding: 1.25rem 0.75rem;
    }

    .footer-links {
        gap: 1rem;
    }

    .footer-link {
        font-size: 0.8rem;
    }

    .footer-divider {
        display: inline-block;
    }

    .footer-text {
        font-size: 0.75rem;
    }
}

main {
    margin-inline: auto;
    width: fit-content;
    margin-top: 4rem;
    min-height: calc(100vh - 3.5rem - 200px);
}

main > #text {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-inline: 2rem;
    margin-bottom: 3.5rem;
    gap: 0.5rem;
}

main > #text > span:first-child {
    font-size: 1.8rem;
    font-weight: 500;
    text-align: center;
}

main > #text > span:last-child {
    font-size: 1rem;
    font-weight: 300;
    color: #999;
    text-align: center;
}

main > #t_home,
main > #t_skins {
    margin-top: 2.5rem;
    padding-inline: 2rem;
    max-width: 35rem;
    margin-inline: auto;
}

main > #t_home > div:first-child,
main > #t_skins > div:first-child {
    font-size: 1.3rem;
    font-weight: 400;
}

main > #t_home > div:first-child > span,
main > #t_skins > div:first-child > span {
    color: #a88a45;
    font-weight: 600;
}

main > #t_home > div:last-child,
main > #t_skins > div:last-child {
    font-weight: 300;
    color: #999;
    font-size: 0.9rem;
    margin-top: 0.4rem;
}

main > #t_home > div:last-child > span,
main > #t_skins > div:last-child > span {
    color: #a88a45;
    font-weight: 400;
}

main > #t_home {
    text-align: left;
    transform: translateX(-1.5rem);
}

main > #t_skins {
    text-align: right;
    margin-top: 3.5rem;
    transform: translateX(1.5rem);
}

main > #recently-viewed {
    margin-top: 3rem;
    padding-inline: 2rem;
    max-width: 38rem;
    margin-inline: auto;
}

#recently-viewed h3 {
    font-size: 1rem;
    font-weight: 500;
    color: #999;
    margin-bottom: 0.5rem;
}

#recently-viewed-list {
    font-size: 1rem;
    color: #666;
    font-style: normal;
}

.recent-profile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid #2e2e2e;
}

.recent-profile:last-child {
    border-bottom: none;
}

.recent-profile-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #fff;
    transition: color 0.15s ease;
    flex: 1;
}

.recent-profile-link:hover {
    color: #a88a45;
}

.recent-username {
    font-weight: 400;
    font-size: 0.95rem;
}

.recent-platform {
    font-size: 0.8rem;
    color: #999;
    text-transform: uppercase;
    font-weight: 300;
}

.recent-time {
    font-size: 0.75rem;
    color: #666;
    font-weight: 300;
}

.recent-profile-card {
    margin: 0;
    position: relative;
}

.recent-profile-card-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    background: #202020;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.recent-profile-card-link:hover {
    background: #2a2a2a;
    border-color: #3a3a3a;
    transform: translateY(-2px);
}

.recent-clear-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.recent-clear-btn:hover {
    background: #2a2a2a;
    color: #f44336;
}

.recent-clear-btn svg {
    width: 14px;
    height: 14px;
}

.recent-profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #242424;
    border: 2px solid #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.recent-profile-avatar svg {
    width: 20px;
    height: 20px;
    color: #999;
}

.recent-profile-info {
    flex: 1;
    min-width: 0;
}

.recent-profile-username {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.25rem;
}

.recent-profile-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #999;
}

.recent-profile-platform {
    color: #a88a45;
    font-weight: 600;
}

.recent-profile-separator {
    color: #555;
}

.recent-profile-time {
    color: #999;
}

main > #buttons {
    width: fit-content;
    margin-inline: auto;
    margin-top: 2rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
}

main > #buttons > #add,
main > #buttons > #search {
    outline: none;
    font-size: 0.95rem;
    line-height: 1.5;
    box-sizing: border-box;
    border: none;
    transition: all 0.2s ease;
    color: #000;
    background: hsl(37, 52%, 65%);
    border-radius: 8px;
    padding: 0.5rem 2rem;
    cursor: pointer;
    text-align: center;
    user-select: none;
    text-decoration: none;
    font-weight: 600;
    letter-spacing: 0;
}

main > #buttons > #add:hover,
main > #buttons > #search:hover {
    background: hsl(37, 52%, 61%);
}

main > #buttons > #add:active,
main > #buttons > #search:active {
    background: hsl(37, 52%, 57%);
}

footer {
    padding: 1.5rem 2rem;
    background: #151617;
    border-top: 1px solid #1e1e1e;
}

.footer-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
}

.footer-link {
    color: #999;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s ease;
    font-weight: 400;
}

.footer-link:hover {
    color: #fff;
}

.footer-divider {
    color: #444;
    font-weight: 300;
}

.footer-text {
    color: #666;
    font-size: 0.8rem;
    line-height: 1;
    margin: 0;
    text-align: center;
    font-weight: 300;
}

.footer-text + .footer-text {
    margin-top: 0.35rem;
}

/* Sticky-bottom footer: body flex column pushes footer down */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body > footer {
    flex-shrink: 0;
    margin-top: auto;
}

main {
    flex: 1;
}

/* Wrapper-div pages (dashboard, profile, stats, etc.) */
#dashPage,
#statsPage,
#profilePage,
#storefrontPage,
#marketplacePage,
#leaderboardsPage {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#dashPage > footer,
#statsPage > footer,
#profilePage > footer,
#storefrontPage > footer,
#marketplacePage > footer,
#leaderboardsPage > footer {
    flex-shrink: 0;
    margin-top: auto;
}

.dash-wrap,
.stats-container,
#skins-page,
.sf-wrap,
.mp-wrap {
    flex: 1;
}