:root {
    --bg-primary: #1a0a2e;
    --bg-secondary: white;
    --text-primary: #333;
    --text-secondary: #666;
    --border-color: #e0e0e0;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --info-bg: #f8f9fa;
}

[data-theme="dark"] {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --border-color: #333;
    --shadow-color: rgba(0, 0, 0, 0.6);
    --info-bg: #252525;
}

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

html {
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    padding: 20px;
    padding-top: 60px;
    position: relative;
    overflow-x: hidden;
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

body::before,
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

body::before {
    background: radial-gradient(ellipse at 20% 50%, rgba(102, 126, 234, 0.4) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 80%, rgba(118, 75, 162, 0.4) 0%, transparent 50%),
                radial-gradient(ellipse at 40% 20%, rgba(102, 126, 234, 0.3) 0%, transparent 50%);
    animation: nebula1 20s ease-in-out infinite alternate;
}

body::after {
    background: radial-gradient(ellipse at 60% 30%, rgba(118, 75, 162, 0.3) 0%, transparent 50%),
                radial-gradient(ellipse at 30% 70%, rgba(102, 126, 234, 0.35) 0%, transparent 50%),
                radial-gradient(ellipse at 90% 50%, rgba(118, 75, 162, 0.25) 0%, transparent 50%);
    animation: nebula2 25s ease-in-out infinite alternate;
}

@keyframes nebula1 {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: translate(-15%, -10%) scale(1.2) rotate(15deg);
        opacity: 0.9;
    }
    100% {
        transform: translate(15%, 10%) scale(0.9) rotate(-15deg);
        opacity: 1;
    }
}

@keyframes nebula2 {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
        opacity: 0.8;
    }
    50% {
        transform: translate(10%, 12%) scale(1.15) rotate(-12deg);
        opacity: 1;
    }
    100% {
        transform: translate(-12%, -10%) scale(0.92) rotate(12deg);
        opacity: 0.85;
    }
}

.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    animation: twinkle 3s ease-in-out infinite;
}

.star::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(2px);
}

.star.small {
    width: 2px;
    height: 2px;
}

.star.medium {
    width: 3px;
    height: 3px;
}

.star.large {
    width: 4px;
    height: 4px;
}

@keyframes twinkle {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.content-wrapper {
    position: relative;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    z-index: 1;
    padding-top: 5px;
}

.logo {
    position: relative;
    display: block;
    margin: 10px auto -60px auto;
    max-width: 600px;
    width: 60%;
    height: auto;
    z-index: 10000;
    pointer-events: none;
}

.logo-link {
    display: block;
    text-decoration: none;
    cursor: pointer;
    pointer-events: auto;
    transition: opacity 0.3s ease, transform 0.3s ease;
    position: relative;
    z-index: 10000;
    isolation: isolate;
}

.logo-link:hover {
    opacity: 0.8;
    transform: scale(1.02);
    z-index: 10000;
}

.logo-link .logo {
    pointer-events: none;
    position: relative;
    z-index: 10000;
}

.container {
    background: var(--bg-secondary);
    border-radius: 20px;
    box-shadow: 0 20px 60px var(--shadow-color);
    padding: 40px;
    max-width: 800px;
    width: 100%;
    position: relative;
    z-index: 1;
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

.logo-spacer {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 40px;
    font-size: 1.1em;
}

.leaderboard-section {
    margin-bottom: 30px;
}

.section-title {
    color: #667eea;
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.leaderboard-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.leaderboard-link {
    display: block;
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    text-align: center;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.leaderboard-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.leaderboard-link:active {
    transform: translateY(0);
}

.info-box {
    background: var(--info-bg);
    border-left: 4px solid #667eea;
    padding: 15px;
    margin-top: 30px;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.info-box p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* Top Banner Styles */
.top-banner {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    background: rgba(23, 26, 33, 0.95) !important;
    backdrop-filter: blur(15px) !important;
    -webkit-backdrop-filter: blur(15px) !important;
    border-bottom: 1px solid rgba(102, 126, 234, 0.2) !important;
    z-index: 1000 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .top-banner {
    background: rgba(10, 10, 10, 0.95) !important;
    border-bottom-color: rgba(102, 126, 234, 0.3) !important;
}

.top-banner-content {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    max-width: 1400px;
    margin: 0 auto;
    padding: 14px 24px !important;
    gap: 20px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.top-banner-left,
.top-banner-right {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    flex-shrink: 0 !important;
}

/* Banner Button Base Styles */
.banner-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 10px 20px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    font-size: 0.9em !important;
    text-decoration: none !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    white-space: nowrap !important;
    position: relative !important;
    overflow: hidden !important;
    font-family: inherit !important;
    line-height: 1.5 !important;
    box-sizing: border-box !important;
}

.banner-btn svg {
    width: 18px !important;
    height: 18px !important;
    flex-shrink: 0 !important;
    display: block !important;
}

.banner-btn span {
    display: inline-block !important;
}

/* Buy Game Button */
.buy-game-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3) !important;
}

.buy-game-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4) !important;
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%) !important;
}

/* Dark Mode Button */
.dark-mode-btn {
    background: rgba(102, 192, 244, 0.15) !important;
    border: 1px solid rgba(102, 192, 244, 0.3) !important;
    color: #66c0f4 !important;
}

.dark-mode-btn:hover {
    background: rgba(102, 192, 244, 0.25) !important;
    border-color: rgba(102, 192, 244, 0.5) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(102, 192, 244, 0.2) !important;
}

/* Login Button */
.login-btn {
    background: linear-gradient(135deg, #66c0f4 0%, #417a9b 100%) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(102, 192, 244, 0.3) !important;
}

.login-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(102, 192, 244, 0.4) !important;
    background: linear-gradient(135deg, #417a9b 0%, #66c0f4 100%) !important;
}

/* User Info */
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(102, 192, 244, 0.4);
}

.user-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9em;
}

.logout-btn {
    padding: 6px 14px;
    background: rgba(102, 192, 244, 0.15);
    border: 1px solid rgba(102, 192, 244, 0.3);
    border-radius: 6px;
    color: #66c0f4;
    font-size: 0.85em;
}

.logout-btn:hover {
    background: rgba(102, 192, 244, 0.25);
    border-color: rgba(102, 192, 244, 0.5);
    transform: translateY(-1px);
}

/* Legacy steam-banner styles for backward compatibility */
.steam-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #171a21 0%, #1b2838 100%);
    padding: 12px 20px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

[data-theme="dark"] .steam-banner {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
}

.dark-mode-toggle {
    background: rgba(102, 192, 244, 0.2) !important;
    border: 1px solid #66c0f4 !important;
    color: #c7d5e0 !important;
    padding: 8px 14px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 0.9em !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
    font-family: inherit !important;
    min-width: 80px !important;
    justify-content: center !important;
    position: relative !important;
    z-index: 1001 !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.dark-mode-toggle:hover {
    background: rgba(102, 192, 244, 0.3);
    transform: translateY(-1px);
}

.dark-mode-toggle svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    display: block;
}

.dark-mode-toggle span {
    white-space: nowrap;
}

.steam-banner-content {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    justify-content: space-between;
}

.steam-banner-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.steam-banner-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.steam-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #c7d5e0;
}

.steam-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #66c0f4;
}

.steam-username {
    font-weight: 500;
    color: #c7d5e0;
}

.steam-logout {
    color: #66c0f4;
    text-decoration: none;
    font-size: 0.9em;
    padding: 6px 12px;
    border: 1px solid #66c0f4;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.steam-logout:hover {
    background: #66c0f4;
    color: #171a21;
}

.buy-game-button {
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(135deg, #66c0f4 0%, #417a9b 100%);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 0.95em;
    box-shadow: 0 2px 8px rgba(102, 192, 244, 0.3);
}

.buy-game-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 192, 244, 0.4);
    background: linear-gradient(135deg, #417a9b 0%, #66c0f4 100%);
}

.steam-login-button {
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(135deg, #66c0f4 0%, #417a9b 100%);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 192, 244, 0.3);
}

.steam-login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 192, 244, 0.4);
}

.steam-login-button::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyIDJMMTMuMDkgOC4yNkwyMSAxMkwxMy4wOSAxNS43NEwxMiAyMkwxMC45MSAxNS43NEwzIDEyTDEwLjkxIDguMjZMMTIgMloiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPg==');
    background-size: contain;
    background-repeat: no-repeat;
    margin-right: 8px;
    vertical-align: middle;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    table-layout: auto;
}

.leaderboard-table thead tr {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #667eea 100%);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
}

.leaderboard-table th {
    background: transparent;
    color: white;
    padding: 12px 16px;
    text-align: center;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: none;
}

.leaderboard-table thead tr:first-child th:first-child {
    border-radius: 8px 0 0 0;
}

.leaderboard-table thead tr:first-child th:last-child {
    border-radius: 0 8px 0 0;
}

@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.leaderboard-table th:first-child {
    width: 80px;
}

.leaderboard-table th:nth-child(2) {
    width: auto;
    text-align: left;
}

.leaderboard-table th:last-child {
    text-align: center;
}

.leaderboard-table td {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    text-align: center;
}

.leaderboard-table td.username,
.leaderboard-table td:nth-child(2) {
    text-align: left;
}

.leaderboard-table tr:last-child td {
    border-bottom: none;
}

.leaderboard-table tr:hover td {
    background: var(--info-bg);
}

.rank {
    text-align: center;
    font-weight: 700;
    font-size: 1em;
    color: #667eea;
}

.rank.gold {
    color: #FFD700;
    font-weight: 800;
}

.rank.silver {
    color: #C0C0C0;
    font-weight: 800;
}

.rank.bronze {
    color: #CD7F32;
    font-weight: 800;
}

.username {
    font-weight: 500;
    color: var(--text-primary);
}

.score {
    text-align: center;
    font-weight: 600;
    color: #667eea;
    font-size: 1em;
}

.nav-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
    flex-wrap: wrap;
}

.nav-tab {
    padding: 10px 20px;
    background: transparent;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    border-radius: 8px 8px 0 0;
    transition: all 0.3s ease;
    position: relative;
}

.nav-tab:hover {
    background: var(--info-bg);
    color: #667eea;
}

.nav-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    .logo {
        width: 80%;
        max-width: 400px;
    }

    .leaderboard-links {
        grid-template-columns: 1fr;
    }

    .nav-tabs {
        gap: 5px;
    }

    .nav-tab {
        padding: 8px 15px;
        font-size: 0.9em;
    }
}
