:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --accent: #8b5cf6;
    --accent-light: #a78bfa;
    --bg-dark: #030014;
    --glass-bg: rgba(255, 255, 255, 0.02);
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-highlight: rgba(255, 255, 255, 0.1);
    --text-main: #ffffff;
    --text-muted: #94a3b8;
    --text-accent: #c4b5fd;
    --glow-primary: rgba(99, 102, 241, 0.4);
    --success: #22c55e;
    --error: #ef4444;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 100% 80% at 20% -30%, rgba(99, 102, 241, 0.25) 0%, transparent 50%),
        radial-gradient(ellipse 80% 60% at 80% 10%, rgba(139, 92, 246, 0.2) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Orbs */
.orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.5;
    pointer-events: none;
    z-index: -1;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    top: -200px;
    left: -150px;
    animation: float1 20s ease-in-out infinite;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    bottom: -150px;
    right: -100px;
    animation: float2 25s ease-in-out infinite;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--primary-light) 0%, transparent 70%);
    top: 40%;
    left: 50%;
    animation: float3 15s ease-in-out infinite;
}

@keyframes float1 {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(50px, 30px);
    }
}

@keyframes float2 {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(-40px, -20px);
    }
}

@keyframes float3 {

    0%,
    100% {
        transform: translate(-50%, -50%);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2);
    }
}

/* ============ NAVBAR ============ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 2rem;
    background: rgba(3, 0, 20, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
}

.nav-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-main);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

@media (max-width: 600px) {
    .nav-right {
        gap: 0.8rem;
    }
}

.online-players {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.25);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
    color: #4ade80;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 0.3rem 0.6rem 0.3rem 0.3rem;
    border-radius: 30px;
}

.nav-avatar {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: cover;
}

/* Settings Dropdown */
.settings-dropdown {
    position: relative;
}

.settings-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    transition: background 0.2s;
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: rgba(10, 10, 30, 0.95);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 0.5rem;
    min-width: 120px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.settings-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu button {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    text-align: left;
    transition: all 0.2s;
}

.dropdown-menu button:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--error);
}

/* ============ CONTAINER ============ */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 5rem 2rem 3rem;
}

/* ============ GLASS PANEL ============ */
.glass-panel {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ============ HERO ============ */
.hero {
    text-align: center;
    padding: 3rem 0 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 40vh;
}

h1 {
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    font-weight: 900;
    margin-bottom: 0.8rem;
    background: linear-gradient(135deg, #fff 0%, var(--primary-light) 50%, var(--accent-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -2px;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    line-height: 1.7;
    max-width: 500px;
}

.section-title {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

/* ============ LOGIN BOX ============ */
.login-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 360px;
    text-align: center;
}

.login-box h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.login-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.9rem 1rem;
    border-radius: 10px;
    font-size: 1rem;
    margin-bottom: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.login-input:focus {
    border-color: var(--primary);
}

.login-input::placeholder {
    color: var(--text-muted);
}

.login-btn {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.9rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.login-btn:hover {
    background: var(--primary-dark);
}

.login-btn:active {
    transform: scale(0.98);
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============ VOTE GRID ============ */
.vote-section-wrapper {
    width: 100%;
    max-width: 600px;
}

.vote-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.site-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 1.5rem 1rem;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
}

.site-box:hover {
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateY(-3px);
}

.site-box.voted {
    opacity: 0.7;
    border-color: rgba(34, 197, 94, 0.3);
}

.site-box.voted::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--success);
    border-radius: 14px 14px 0 0;
}

.site-number {
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary-light);
    margin-bottom: 0.3rem;
}

.site-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.site-status {
    font-size: 0.75rem;
    margin-bottom: 0.8rem;
    color: var(--text-muted);
}

.cooldown-timer {
    font-size: 0.8rem;
    color: var(--success);
    font-weight: 600;
}

.vote-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.vote-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--glow-primary);
}

/* ============ STATS ============ */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin: 2rem auto;
    padding: 1.5rem 2rem;
    max-width: 500px;
}

.stat-item {
    text-align: center;
}

.stat-item h3 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 0.2rem;
}

.stat-item p {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* ============ LEADERBOARD ============ */
.leaderboard-section {
    max-width: 550px;
    margin: 3rem auto;
}

.leaderboard-tabs {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    margin-bottom: 1rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.3rem;
    border-radius: 12px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
}

.leaderboard-panel {
    padding: 1rem;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.leaderboard-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
    transition: all 0.2s;
}

.leaderboard-row:hover {
    background: rgba(255, 255, 255, 0.04);
    transform: translateX(3px);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.rank {
    font-weight: 800;
    font-size: 0.9rem;
    width: 35px;
    color: var(--text-muted);
}

.rank-1 {
    color: #ffd700;
}

.rank-2 {
    color: #c0c0c0;
}

.rank-3 {
    color: #cd7f32;
}

.player-head {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--glass-bg);
}

.player-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.vote-count {
    font-weight: 700;
    color: var(--primary-light);
    font-size: 0.9rem;
}

/* ============ MODAL ============ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    padding: 2rem;
    text-align: center;
    min-width: 320px;
    animation: modalPop 0.25s ease;
}

.modal-content h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.modal-cancel {
    margin-top: 1.2rem;
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    padding: 0.5rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-cancel:hover {
    border-color: var(--error);
    color: var(--error);
}

@keyframes modalPop {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============ TOAST ============ */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.toast {
    background: rgba(10, 10, 30, 0.95);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.9rem 1.3rem;
    border-radius: 10px;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
    animation: slideIn 0.3s ease;
    font-weight: 500;
    font-size: 0.9rem;
}

.toast-success {
    border-color: var(--success);
}

.toast-error {
    border-color: var(--error);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============ UTILITY ============ */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.loading-text,
.empty-text {
    text-align: center;
    color: var(--text-muted);
    padding: 1.5rem;
}

.error-text {
    text-align: center;
    color: var(--error);
    padding: 1.5rem;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .navbar {
        padding: 0.6rem 1rem;
    }

    .nav-title {
        font-size: 1.1rem;
    }

    h1 {
        font-size: 2.5rem;
    }

    .vote-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-bar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .container {
        padding: 5rem 1.5rem 2rem;
    }

    .orb {
        opacity: 0.3;
        /* dim orbs on mobile for performance */
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 0.8rem 1rem;
    }

    .nav-brand {
        gap: 0.5rem;
    }

    .nav-logo {
        width: 28px;
        height: 28px;
    }

    .nav-title {
        font-size: 1rem;
    }

    .online-players {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }

    /* Hide User Profile Text on Mobile, keep avatar if needed or simplify */
    .nav-user {
        padding: 0;
        background: transparent;
        border: none;
    }

    #navIgn {
        display: none;
        /* Hide IGN text on mobile */
    }

    .nav-avatar {
        width: 32px;
        height: 32px;
        border: 1px solid var(--glass-border);
    }

    h1 {
        font-size: 2rem;
        margin-top: 1rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    .vote-grid {
        grid-template-columns: 1fr;
        /* Stack vote cards on very small screens */
        gap: 1rem;
    }

    .site-box {
        padding: 1.2rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
        text-align: left;
    }

    .site-number {
        font-size: 1.5rem;
        margin-bottom: 0;
        margin-right: 1rem;
    }

    .site-label {
        font-size: 0.9rem;
        margin-bottom: 0;
    }

    .site-status {
        margin-bottom: 0;
        font-size: 0.7rem;
    }

    /* Re-arrange flex for site box */
    .site-box {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .site-box .vote-btn {
        margin-left: auto;
    }

    .stats-bar {
        padding: 1.5rem;
        gap: 1.5rem;
    }

    .stat-item h3 {
        font-size: 1.6rem;
    }

    .leaderboard-tabs {
        width: 100%;
        justify-content: space-between;
    }

    .tab-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.75rem;
        flex: 1;
    }
}