/* ════════════════════════════════════════════════════
   Global Styles
   ════════════════════════════════════════════════════ */

/* ── Variables ── */

:root {
    --bg:           #0F0A1A;
    --card:         #1C1430;
    --border:       #2D1B4E;
    --text:         #F5F3FF;
    --text-sec:     #C4B5FD;
    --accent:       #A855F7;
    --accent-dark:  #6D28D9;
    --accent-light: #D8B4FE;
    --flair:        #F0ABFC;
}

/* ── Reset ── */

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

/* ── Base ── */

body {
    overflow-x: hidden; /* safety net - nothing on the page should force horizontal scroll on small screens.
                            Deliberately not also set on html: overflow-x on both html and body defeats the
                            browser's normal propagation of body's overflow to the viewport and turns html into
                            its own scroll container, which silently breaks position:sticky (header, sidebar) */
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100vh;
}

/* ── Animations ── */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes drift-1 {
    0%   { transform: translate(0px,    0px)   scale(1);    }
    25%  { transform: translate(160px,  100px) scale(1.08); }
    50%  { transform: translate(80px,   260px) scale(0.95); }
    75%  { transform: translate(-60px,  140px) scale(1.05); }
    100% { transform: translate(0px,    0px)   scale(1);    }
}

@keyframes drift-2 {
    0%   { transform: translate(0px,    0px)    scale(1);    }
    25%  { transform: translate(-140px, -80px)  scale(1.1);  }
    50%  { transform: translate(-60px,  -200px) scale(0.92); }
    75%  { transform: translate(100px,  -100px) scale(1.06); }
    100% { transform: translate(0px,    0px)    scale(1);    }
}

@keyframes drift-3 {
    0%   { transform: translate(0px,   0px)   scale(1);    }
    33%  { transform: translate(-80px, 120px) scale(1.12); }
    66%  { transform: translate(60px,  -80px) scale(0.9);  }
    100% { transform: translate(0px,   0px)   scale(1);    }
}

@keyframes drift-4 {
    0%   { transform: translate(0px,   0px)    scale(1);    }
    30%  { transform: translate(120px, -100px) scale(1.07); }
    60%  { transform: translate(-80px, -60px)  scale(0.95); }
    100% { transform: translate(0px,   0px)    scale(1);    }
}

/* ── Animated Background ── */

.bg-canvas {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(75px);
    will-change: transform, filter;
}

.orb-1 {
    width: 700px;
    height: 700px;
    background: radial-gradient(circle at center, #A855F7 0%, transparent 70%);
    opacity: 0.22;
    top: -200px;
    left: -150px;
    animation: drift-1 22s ease-in-out infinite;
}

.orb-2 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle at center, #6D28D9 0%, transparent 70%);
    opacity: 0.3;
    bottom: -180px;
    right: -120px;
    animation: drift-2 28s ease-in-out infinite;
}

.orb-3 {
    width: 420px;
    height: 420px;
    background: radial-gradient(circle at center, #F0ABFC 0%, transparent 70%);
    opacity: 0.13;
    top: 30%;
    right: 10%;
    animation: drift-3 18s ease-in-out infinite;
}

.orb-4 {
    width: 520px;
    height: 520px;
    background: radial-gradient(circle at center, #7C3AED 0%, transparent 70%);
    opacity: 0.2;
    bottom: 5%;
    left: 20%;
    animation: drift-4 24s ease-in-out infinite;
}

/* ── Page Layout ── */

.main {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 68px);
    padding: 0 24px;
    animation: fadeIn 0.2s ease;
}

/* ── Placeholder Pages ── */

.page-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 68px);
    gap: 14px;
    padding: 24px;
    text-align: center;
}

.page-content h1 {
    font-size: clamp(1.8rem, 3.5vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
}

.page-content p {
    color: var(--text-sec);
    font-size: 0.95rem;
}

.page-badge {
    display: inline-block;
    padding: 4px 14px;
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 999px;
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ════════════════════════════════════════════════════
   Header
   ════════════════════════════════════════════════════ */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding-left: 28px;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* ── Brand ── */

.header-left {
    display: flex;
    align-items: center;
    gap: 11px;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 11px;
    text-decoration: none;
}

.logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 8px;
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
}

.brand-accent {
    color: var(--accent);
}

/* ── Header Right ── */

.header-right {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 16px;
}

.header-divider {
    width: 1px;
    height: 22px;
    background: var(--border);
    flex-shrink: 0;
    margin: 0 4px;
}

/* ── Steam Sign-in ── */

.steam-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    align-self: stretch;
    padding: 0 26px;
    border: 1.5px solid var(--border);
    color: var(--text-sec);
    font-size: 0.855rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition:
        color        0.22s ease,
        border-color 0.22s ease,
        background   0.22s ease;
}

.steam-box:hover {
    color: var(--text);
    border-color: rgba(168, 85, 247, 0.4);
    background: rgba(168, 85, 247, 0.06);
}

.steam-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    object-fit: contain;
}

/* ── Nav Buttons ── */

.header-nav {
    display: flex;
    align-items: center;
}

.nav-btn {
    position: relative;
    background: none;
    border: none;
    color: var(--text-sec);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0 14px;
    height: 68px;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.nav-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--accent);
    border-radius: 2px 2px 0 0;
    transition: width 0.25s ease;
}

.nav-btn:hover,
.nav-btn.active {
    color: var(--text);
}

.nav-btn:hover::after,
.nav-btn.active::after {
    width: calc(100% - 28px);
}

/* ════════════════════════════════════════════════════
   Locale Picker
   ════════════════════════════════════════════════════ */

.locale-picker {
    position: relative;
}

.locale-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 38px;
    padding: 0 14px;
    background: transparent;
    color: var(--text-sec);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.855rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition:
        color        0.2s ease,
        border-color 0.2s ease,
        background   0.2s ease;
}

.locale-btn:hover,
.locale-btn.open {
    color: var(--text);
    border-color: rgba(168, 85, 247, 0.45);
    background: rgba(168, 85, 247, 0.07);
}

.locale-globe {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.locale-chevron {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    transition: transform 0.22s ease;
}

.locale-btn.open .locale-chevron {
    transform: rotate(180deg);
}

/* ── Popup Panel ── */

.locale-popup {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 268px;
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: 18px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 200;
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(168, 85, 247, 0.08);
    backdrop-filter: blur(12px);
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition:
        opacity   0.2s ease,
        transform 0.2s ease;
}

.locale-popup.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.locale-section {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.locale-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-sec);
}

/* ── Custom Select ── */

.custom-select {
    position: relative;
}

.custom-select-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    height: 40px;
    padding: 0 12px;
    background: var(--bg);
    color: var(--text);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 400;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.custom-select-btn:hover,
.custom-select-btn.open {
    border-color: rgba(168, 85, 247, 0.5);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1);
}

.select-chevron {
    width: 13px;
    height: 13px;
    color: var(--text-sec);
    pointer-events: none;
    flex-shrink: 0;
    transition: transform 0.22s ease;
}

.custom-select-btn.open .select-chevron {
    transform: rotate(180deg);
}

.custom-select-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    overflow-y: auto;
    max-height: 200px;
    z-index: 10;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6);
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(168, 85, 247, 0.3) transparent;
}

.custom-select-list::-webkit-scrollbar {
    width: 4px;
}

.custom-select-list::-webkit-scrollbar-thumb {
    background: rgba(168, 85, 247, 0.3);
    border-radius: 4px;
}

.custom-select-list.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.custom-select-opt {
    display: block;
    width: 100%;
    padding: 9px 12px;
    background: none;
    color: var(--text);
    border: none;
    font-family: inherit;
    font-size: 0.84rem;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.13s ease;
}

.custom-select-opt:hover {
    background: rgba(168, 85, 247, 0.1);
}

.custom-select-opt.active {
    color: var(--accent);
    background: rgba(168, 85, 247, 0.08);
    font-weight: 500;
}

/* ════════════════════════════════════════════════════
   Responsive - Header
   ════════════════════════════════════════════════════ */

@media (max-width: 1100px) {
    .header {
        padding-left: 18px;
    }

    .header-right {
        gap: 10px;
    }

    .nav-btn {
        padding: 0 9px;
        font-size: 0.82rem;
    }

    .steam-box {
        padding: 0 16px;
        font-size: 0.8rem;
    }
}

@media (max-width: 860px) {
    .header {
        flex-wrap: wrap;
        height: auto;
        min-height: 68px;
        padding: 12px 16px;
        row-gap: 10px;
    }

    .header-right {
        height: auto;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        row-gap: 10px;
    }

    .header-nav {
        order: 1;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .nav-btn {
        height: 38px;
    }

    .header-divider {
        display: none;
    }

    .steam-box {
        align-self: auto;
        height: 38px;
        border-radius: 8px;
    }
}

@media (max-width: 480px) {
    .brand-name {
        font-size: 1.1rem;
    }

    .steam-box span {
        display: none; /* icon-only on very small screens - not enough room for the full label */
    }

    .steam-box {
        padding: 0 12px;
    }

    #localeLabel {
        display: none; /* keep just the globe icon + chevron - button still opens the same popup */
    }
}
