:root {
    --bg-color: #000000;
    --card-bg: linear-gradient(180deg, #000000 0%, #202020 100%);
    --card-border: rgba(255, 255, 255, 0.1);
    --primary: #FF5500;
    --secondary: #FF2E00;
    --text-main: #FFFFFF;
    --text-muted: #8892b0;
    --correct-bg: rgba(0, 255, 128, 0.2);
    --wrong-bg: rgba(255, 50, 50, 0.2);
    --warning: #ffb703;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: #050505; /* Solid dark base */
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* GLOWING ORBS ATMOSPHERE */
.glow-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.5;
    animation: floatOrb 20s infinite alternate ease-in-out;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255,145,83,0.15) 0%, rgba(255,145,83,0) 70%);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(255,46,0,0.1) 0%, rgba(255,46,0,0) 70%);
    bottom: -200px;
    right: -200px;
    animation-delay: -5s;
}

.orb-3 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255,183,3,0.08) 0%, rgba(255,183,3,0) 70%);
    top: 40%;
    left: 40%;
    animation-delay: -10s;
}

@keyframes floatOrb {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(100px, 50px) scale(1.1); }
    100% { transform: translate(-50px, 150px) scale(0.9); }
}

/* PAGE TRANSITIONS */
.page {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    animation: fadeInUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.page.active {
    display: block;
}

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

.app-container {
    display: flex;
    flex-direction: row;
    height: 100vh;
    overflow: hidden;
}

/* SIDEBAR */
.sidebar {
    width: 250px;
    background: rgba(10, 10, 15, 0.8);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.logo {
    text-align: center;
}

nav {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 2rem;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 1rem;
    border-radius: 8px;
    transition: all 0.3s;
    font-weight: 600;
    text-align: left;
}
/* HOME HERO SECTION */
.home-hero {
    max-width: 800px;
    margin: 10vh auto;
    text-align: center;
    background: rgba(15, 15, 20, 0.6);
    padding: 4rem 3rem;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.05);
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    color: #FFF;
}

.hero-subtitle {
    font-size: 1.3rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 3rem;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 3rem;
}

.stat-box {
    background: rgba(255, 145, 83, 0.1);
    border: 1px solid rgba(255, 145, 83, 0.3);
    padding: 1.5rem;
    border-radius: 12px;
    min-width: 120px;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

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

.countdown-timer {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.time-box {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 145, 83, 0.2);
    border-radius: 12px;
    padding: 1rem;
    min-width: 80px;
    box-shadow: inset 0 0 10px rgba(255, 145, 83, 0.1);
}

.time-val {
    display: block;
    font-size: 2.2rem;
    font-weight: 800;
    color: #FFF;
    font-family: monospace;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.time-label {
    display: block;
    font-size: 0.8rem;
    color: var(--primary);
    text-transform: uppercase;
    font-weight: 700;
    margin-top: 0.3rem;
}

.hero-cta {
    font-size: 1.2rem;
    padding: 1.2rem 3rem;
    border-radius: 30px;
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 10px rgba(255, 145, 83, 0.4); }
    50% { box-shadow: 0 0 30px rgba(255, 145, 83, 0.8), 0 0 50px rgba(255, 46, 0, 0.6); }
    100% { box-shadow: 0 0 10px rgba(255, 145, 83, 0.4); }
}
.nav-btn:hover {
    color: var(--text-main);
    background: var(--card-bg);
}

.nav-btn.active {
    color: var(--text-main);
    background: linear-gradient(90deg, rgba(255, 145, 83, 0.15), rgba(255, 46, 0, 0.15));
    border: 1px solid rgba(255, 145, 83, 0.3);
}

/* PAGES */
main {
    flex: 1;
    padding: 3rem;
    overflow-y: auto;
    position: relative;
}

.page {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.page.active {
    display: block;
}

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

/* AUTHENTICATION */
.auth-container {
    max-width: 400px;
    margin: 10vh auto;
    text-align: center;
    background: rgba(15, 15, 20, 0.6);
    padding: 3rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.05);
}

.auth-container h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.auth-container p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.auth-container input {
    width: 100%;
    padding: 1rem;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s;
}

.auth-container input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(255, 145, 83, 0.2);
}

.group-box {
    background: rgba(20, 20, 25, 0.6);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.group-box:hover {
    border-color: rgba(255, 145, 83, 0.3);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5), inset 0 0 20px rgba(255,145,83,0.05);
    transform: translateY(-3px);
}
.primary-btn {
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    color: #FFF;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    width: 100%;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.primary-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: all 0.5s;
    z-index: -1;
}

.primary-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 10px 20px rgba(255, 46, 0, 0.4);
}

.primary-btn:hover::before {
    left: 100%;
}

.primary-btn.warning {
    background: linear-gradient(135deg, #ff7e5f, #feb47b);
    box-shadow: 0 5px 15px rgba(255, 126, 95, 0.3);
}

/* PREDICTION UI */
.welcome-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.welcome-bar h3 span {
    color: var(--primary);
}

.instruction-text {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.welcome-bar .primary-btn {
    width: auto;
}

.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.group-card {
    background: rgba(15, 15, 20, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(255,255,255,0.02);
}

.group-header {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid var(--card-border);
    font-weight: 600;
    font-size: 1.2rem;
}

.team-list {
    list-style: none;
}

.rank-item {
    height: 48px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--text-muted);
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.rank-active {
    transform: scale(1.6);
    color: var(--primary);
    text-shadow: 0 0 10px rgba(255,145,83,0.8);
}

.team-item {
    display: flex;
    align-items: center;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--card-border);
    margin-bottom: 0.5rem;
    padding: 0 1rem;
    border-radius: 8px;
    cursor: grab;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    height: 48px;
    box-sizing: border-box;
    border-left: 3px solid transparent;
}

.team-item:active {
    cursor: grabbing;
    transform: scale(0.98);
}

.team-item:hover {
    background: rgba(255, 145, 83, 0.15);
    border-left: 3px solid var(--primary);
    transform: translateX(4px);
    box-shadow: 0 4px 15px rgba(255, 145, 83, 0.1);
}


.team-name {
    flex-grow: 1;
    font-weight: 500;
}

.team-item.sortable-ghost {
    opacity: 0.4;
}

.team-item.sortable-drag {
    background: var(--primary);
    color: black;
}

/* LEADERBOARD */
.leaderboard-container {
    max-width: 800px;
    margin: 0 auto;
}

.points-info {
    background: rgba(255, 145, 83, 0.1);
    border: 1px solid rgba(255, 145, 83, 0.3);
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    text-align: center;
    font-weight: 600;
    color: var(--primary);
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    background: rgba(15, 15, 20, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(15px);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.sortable-item {
    background: rgba(30, 30, 35, 0.8);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 1rem;
    margin-bottom: 0.8rem;
    border-radius: 12px;
    cursor: grab;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.sortable-item:hover {
    background: rgba(40, 40, 45, 0.9);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
}

.sortable-item:active {
    cursor: grabbing;
}

.sortable-ghost {
    opacity: 0.4;
    background: rgba(255, 145, 83, 0.2);
    border: 1px dashed var(--primary);
    transform: scale(0.98);
}

.sortable-drag {
    background: rgba(40, 40, 45, 0.95) !important;
    border: 1px solid var(--primary) !important;
    box-shadow: 0 15px 30px rgba(255, 145, 83, 0.3) !important;
    transform: scale(1.05) !important;
}

.leaderboard-item:hover {
    transform: scale(1.02) translateX(5px);
    border-color: var(--primary);
    box-shadow: 0 5px 20px rgba(255, 145, 83, 0.2);
}

.lb-rank-1 {
    border-color: #FFD700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.2), inset 0 0 10px rgba(255, 215, 0, 0.1);
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.15), rgba(20, 20, 25, 0.8));
    transform: scale(1.02);
    animation: goldGlow 3s infinite alternate;
}
.lb-rank-1 .lb-rank { color: #FFD700; text-shadow: 0 0 15px rgba(255,215,0,0.8); font-size: 2rem; }

@keyframes goldGlow {
    from { box-shadow: 0 0 15px rgba(255, 215, 0, 0.2); }
    to { box-shadow: 0 0 30px rgba(255, 215, 0, 0.5), inset 0 0 15px rgba(255, 215, 0, 0.2); }
}

.lb-rank-2 {
    border-color: #E0E0E0;
    box-shadow: 0 0 15px rgba(224, 224, 224, 0.1);
    background: linear-gradient(90deg, rgba(224, 224, 224, 0.1), rgba(20, 20, 25, 0.8));
}
.lb-rank-2 .lb-rank { color: #E0E0E0; text-shadow: 0 0 10px rgba(224,224,224,0.5); font-size: 1.8rem; }

.lb-rank-3 {
    border-color: #CD7F32;
    box-shadow: 0 0 15px rgba(205, 127, 50, 0.1);
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.1), rgba(20, 20, 25, 0.8));
}
.lb-rank-3 .lb-rank { color: #CD7F32; text-shadow: 0 0 10px rgba(205,127,50,0.5); font-size: 1.6rem; }

.lb-rank {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    width: 40px;
}

.lb-user {
    flex-grow: 1;
    font-size: 1.2rem;
    font-weight: 600;
}

.lb-score {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
}
.lb-rank-1 .lb-score { color: #FFD700; text-shadow: 0 0 10px rgba(255,215,0,0.5); }
.lb-rank-2 .lb-score { color: #E0E0E0; text-shadow: 0 0 10px rgba(224,224,224,0.5); }
.lb-rank-3 .lb-score { color: #CD7F32; text-shadow: 0 0 10px rgba(205,127,50,0.5); }

/* TOAST */
.toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: #000;
    padding: 1rem 2rem;
    border-radius: 30px;
    font-weight: 600;
    transition: bottom 0.3s ease;
    z-index: 1000;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.toast.show {
    bottom: 30px;
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        position: fixed;
        bottom: 0;
        left: 0;
        padding: 0.5rem;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        border-right: none;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        z-index: 9999;
    }
    
    .logo {
        display: none;
    }
    
    nav {
        flex-direction: row;
        width: 100%;
        margin-top: 0;
        gap: 0.2rem;
        justify-content: space-around;
    }
    
    .nav-btn {
        padding: 0.8rem 0.5rem;
        font-size: 0.85rem;
        text-align: center;
        flex: 1;
        border-left: none;
        border-bottom: 3px solid transparent;
    }
    
    .nav-btn.active {
        background: transparent;
        border-left: none;
        border-bottom: 3px solid var(--primary);
        color: var(--primary);
    }
    
    main {
        padding: 1rem;
        padding-bottom: 80px; /* Space for bottom nav */
    }

    .home-hero {
        padding: 2rem 1.5rem;
        margin: 5vh auto;
    }
    
    .hero-title {
        font-size: 2.2rem;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .auth-container {
        padding: 1.5rem;
        margin: 2vh auto;
    }
    
    .welcome-bar {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    #action-buttons-group {
        flex-direction: column;
        width: 100%;
    }
    
    #action-buttons-group button {
        width: 100%;
    }
    
    .leaderboard-item {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .lb-rank {
        width: auto;
    }
}
