/* Reset and Variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #0a0a0a;
    --surface-dark: #0f1a0f;
    --surface-light: #1a251a;
    --border-color: #2a352a;
    --text-primary: #e0e0e0;
    --text-secondary: #909090;
    --primary-color: #4ade80;  /* Softer green */
    --secondary-color: #22c55e; /* Medium green */
    --accent-color: #16a34a;   /* Darker green */
    --warning-color: #86efac;  /* Light green */
    --grey-light: #707070;
    --grey-dark: #404040;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

/* Main Layout */
.game-container {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    height: 100vh;
    gap: 0;
}

/* Left Sidebar */
.sidebar-left {
    background: var(--surface-dark);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.brand i {
    font-size: 2rem;
    color: var(--primary-color);
}

.brand h2 {
    font-family: 'Orbitron', monospace;
    font-size: 1.5rem;
    font-weight: 900;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Navigation */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.nav-item:hover {
    background: var(--surface-light);
    color: var(--text-primary);
    transform: translateX(5px);
}

.nav-item.active {
    background: rgba(0, 255, 136, 0.1);
    color: var(--primary-color);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 70%;
    background: var(--primary-color);
    border-radius: 2px;
}

.nav-item i {
    font-size: 1.25rem;
    width: 24px;
}

/* User Section */
.user-section {
    margin-top: auto;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface-light);
    border-radius: 12px;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
}

.user-card .user-avatar {
    flex-shrink: 0;
}

.user-details h4 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.logout-btn {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-decoration: none;
    transition: color 0.3s ease;
}

.logout-btn:hover {
    color: var(--accent-color);
}

.discord-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: var(--grey-dark);
    color: var(--text-primary);
    padding: 1rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid var(--grey-light);
}

.discord-login:hover {
    background: var(--grey-light);
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

/* Leaderboard Preview */
.leaderboard-preview {
    background: var(--surface-light);
    padding: 1.5rem;
    border-radius: 12px;
}

.leaderboard-preview h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--warning-color);
}

.top-players {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.top-player {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.top-player .rank {
    font-weight: 700;
    color: var(--warning-color);
    min-width: 30px;
}

.top-player .name {
    flex: 1;
    color: var(--text-secondary);
}

.top-player .score {
    font-weight: 600;
    color: var(--primary-color);
}

/* Main Game Area */
.game-main {
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 1.5rem;
    position: relative;
    overflow: hidden;
}

/* Animated background */
.game-main::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, transparent 0%, rgba(0, 255, 136, 0.03) 50%, transparent 100%);
    animation: rotate 30s linear infinite;
}

@keyframes rotate {
    100% { transform: rotate(360deg); }
}

.game-header {
    text-align: center;
    position: relative;
    z-index: 1;
}

.game-stats {
    display: flex;
    gap: 3rem;
    justify-content: center;
    background: rgba(20, 20, 20, 0.8);
    padding: 1.5rem 3rem;
    border-radius: 20px;
    border: 1px solid rgba(0, 255, 136, 0.2);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.stat-value {
    display: block;
    font-family: 'Orbitron', monospace;
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
}

.game-stats {
    display: flex;
    gap: 3rem;
    justify-content: center;
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.stat-value {
    display: block;
    font-family: 'Orbitron', monospace;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Game Canvas */
.game-area {
    position: relative;
    z-index: 1;
}

#gameCanvas {
    background: #000;
    border: 3px solid transparent;
    border-radius: 16px;
    position: relative;
    box-shadow: 
        0 0 50px rgba(0, 255, 0, 0.3),
        inset 0 0 50px rgba(0, 0, 0, 0.5);
}

/* Animated border */
.game-area::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(45deg, var(--secondary-color), var(--primary-color), var(--accent-color), var(--secondary-color));
    background-size: 300% 300%;
    border-radius: 16px;
    z-index: -1;
    animation: borderGlow 4s ease infinite;
}

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

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
}

.overlay-content {
    text-align: center;
    padding: 3rem;
    background: linear-gradient(135deg, var(--surface-dark) 0%, var(--surface-light) 100%);
    border: 2px solid var(--primary-color);
    border-radius: 24px;
    backdrop-filter: blur(20px);
    box-shadow: 
        0 0 60px rgba(74, 222, 128, 0.3),
        inset 0 0 60px rgba(0, 0, 0, 0.5);
    animation: overlayAppear 0.5s ease;
    max-width: 500px;
    width: 90%;
    position: relative;
    overflow: hidden;
}

/* Animated background pattern */
.overlay-content::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(74, 222, 128, 0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
    z-index: -1;
}

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

.overlay-icon {
    font-size: 5rem;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
    animation: iconPulse 2s ease infinite;
    filter: drop-shadow(0 0 20px rgba(74, 222, 128, 0.5));
}

@keyframes iconPulse {
    0%, 100% { 
        transform: scale(1) rotate(0deg); 
    }
    50% { 
        transform: scale(1.1) rotate(5deg); 
    }
}

.overlay-content h2 {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 0 0 20px rgba(74, 222, 128, 0.5);
}

.overlay-content p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 1rem;
    line-height: 1.6;
}

#gameOverStats {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 1px solid rgba(74, 222, 128, 0.2);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    font-size: 1rem;
    border-bottom: 1px solid rgba(74, 222, 128, 0.1);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-row span:first-child {
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-row span:last-child {
    color: var(--primary-color);
    font-weight: 700;
    font-family: 'Orbitron', monospace;
}

/* Start Button */
.start-button {
    margin-top: 2rem;
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    border: none;
    color: var(--bg-dark);
    padding: 1rem 3rem;
    border-radius: 50px;
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-family: 'Orbitron', monospace;
    letter-spacing: 1px;
    box-shadow: 
        0 5px 20px rgba(74, 222, 128, 0.4),
        inset 0 0 20px rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.start-button::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: rotate(45deg);
    transition: all 0.6s;
    opacity: 0;
}

.start-button:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 8px 30px rgba(74, 222, 128, 0.6),
        inset 0 0 30px rgba(255, 255, 255, 0.2);
}

.start-button:hover::before {
    animation: shine 0.6s ease;
}

@keyframes shine {
    0% {
        left: -50%;
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        left: 150%;
        opacity: 0;
    }
}

.start-button:active {
    transform: translateY(-1px);
}

.start-button i {
    font-size: 1.25rem;
}

/* Game Controls */
.game-controls {
    display: flex;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.control-btn {
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.control-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, var(--primary-color), transparent);
    transform: translate(-50%, -50%);
    transition: all 0.6s ease;
    opacity: 0.3;
}

.control-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 255, 0, 0.3);
    border-color: var(--primary-color);
}

.control-btn:hover::before {
    width: 100%;
    height: 100%;
}

.control-btn:active {
    transform: translateY(-1px);
}

.control-btn i {
    font-size: 1rem;
}

/* Right Sidebar */
.sidebar-right {
    background: var(--surface-dark);
    border-left: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    overflow-y: auto;
}

.sidebar-right > div {
    background: var(--surface-light);
    padding: 1.5rem;
    border-radius: 12px;
}

.sidebar-right h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.sidebar-right h3 i {
    color: var(--primary-color);
}

/* Player Stats */
.stats-grid {
    display: grid;
    gap: 1rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-item .label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.stat-item .value {
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.25rem;
    transition: all 0.3s ease;
}

.stat-item .value.updated {
    animation: statUpdate 1s ease;
}

@keyframes statUpdate {
    0% {
        transform: scale(1);
        color: var(--primary-color);
    }
    50% {
        transform: scale(1.2);
        color: #86efac;
        text-shadow: 0 0 10px rgba(134, 239, 172, 0.5);
    }
    100% {
        transform: scale(1);
        color: var(--primary-color);
    }
}

/* How to Play */
.instructions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.instruction-item i {
    color: var(--secondary-color);
    width: 20px;
    font-size: 1.125rem;
}

/* Power-ups */
.powerup-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.powerup-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.powerup-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border-radius: 8px;
}

.powerup-icon.red {
    background: rgba(128, 128, 128, 0.2);
    color: var(--grey-light);
}

.powerup-icon.purple {
    background: rgba(0, 136, 0, 0.2);
    color: var(--accent-color);
}

.powerup-icon.blue {
    background: rgba(0, 255, 0, 0.2);
    color: var(--primary-color);
}

.powerup-desc strong {
    display: block;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.powerup-desc span {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Daily Challenge */
.daily-challenge {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.1), rgba(0, 204, 255, 0.1)) !important;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.challenge-desc {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.progress-bar {
    background: rgba(0, 0, 0, 0.5);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    height: 100%;
    transition: width 0.3s ease;
}

.reward {
    text-align: center;
    color: var(--warning-color);
    font-weight: 600;
    font-size: 0.875rem;
}

/* Achievement Popup */
.achievement-popup {
    position: fixed;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface-dark);
    border: 2px solid var(--primary-color);
    padding: 2rem 3rem;
    border-radius: 12px;
    text-align: center;
    transition: top 0.5s ease;
    z-index: 1000;
}

.achievement-popup.show {
    top: 50px;
}

.achievement-popup i {
    font-size: 3rem;
    color: var(--warning-color);
    margin-bottom: 1rem;
}

.achievement-popup h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.achievement-popup p {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.achievement-popup span {
    color: var(--warning-color);
    font-weight: 600;
}

/* Stats update animation */
.stat-value.updated {
    animation: statPulse 1s ease;
}

@keyframes statPulse {
    0% {
        transform: scale(1);
        color: var(--text-primary);
    }
    50% {
        transform: scale(1.2);
        color: var(--primary-color);
        text-shadow: 0 0 20px var(--primary-color);
    }
    100% {
        transform: scale(1);
        color: var(--text-primary);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Responsive */
@media (max-width: 1400px) {
    .game-container {
        grid-template-columns: 240px 1fr 280px;
    }
    
    .game-title {
        font-size: 3rem;
    }
}

@media (max-width: 1200px) {
    .game-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    
    .sidebar-left {
        display: none;
    }
    
    .sidebar-right {
        display: none;
    }
    
    .game-main {
        grid-row: 2;
    }
}

/* No scores message */
.no-scores {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding: 1rem;
}
