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

/* CSS Variables for Game Mode Colors */
:root {
    /* Game Mode Background Colors - Dark Shades */
    --classic-bg: #1a2e1a; /* Dark green */
    --practice-bg: #4b4b4b; /* Dark gray */
    --hard-bg: #2e1a1a; /* Dark red */
    --quick-bg: #2e2e1a; /* Dark yellow */
    --timetrial-bg: #1a1a1a; /* Black */
    --marathon-bg: #1a2e2e; /* Dark teal */
    --survival-bg: #2e2a1a; /* Dark orange */
    --expert-bg: #1e1a2e; /* Dark purple */
    
    /* Game Mode Accent Colors - Consistent with game mode themes */
    --classic-accent: #22c55e; /* Green */
    --practice-accent: #9ca3af; /* Light gray */
    --hard-accent: #ef4444; /* Red */
    --quick-accent: #f59e0b; /* Yellow */
    --timetrial-accent: #6b7280; /* Dark gray for black background */
    --marathon-accent: #06b6d4; /* Cyan */
    --survival-accent: #f97316; /* Orange */
    --expert-accent: #8b5cf6; /* Purple */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
    color: white;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Header */
.header {
    text-align: center;
    padding: 40px 20px 30px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    position: relative;
}

/* Authentication Panel */
.auth-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 1000;
}

.auth-status {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 15px;
    border-radius: 25px;
    border: 1px solid #333;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #22c55e;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    line-height: 1;
}

.user-status {
    font-size: 0.7rem;
    color: #888;
    line-height: 1;
}

.auth-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.auth-button {
    background: linear-gradient(45deg, #4285f4, #34a853);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(66, 133, 244, 0.3);
}

.auth-button.sign-out {
    background: linear-gradient(45deg, #dc2626, #ef4444);
}

.auth-button.sign-out:hover {
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3);
}

.auth-button.profile-btn {
    background: linear-gradient(45deg, #8b5cf6, #a855f7);
    font-size: 0.85rem;
    padding: 8px 16px;
}

.auth-button.profile-btn:hover {
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.logo {
    font-size: 3rem;
    font-weight: bold;
    background: linear-gradient(45deg, #22c55e, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.5rem;
    color: #888;
    margin-bottom: 20px;
}

/* Navigation */
.nav-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
    margin-bottom: 40px;
}

.nav-links a {
    color: #bbb;
    text-decoration: none;
    font-size: 1rem;
    position: relative;
}

.nav-links a.active {
    color: #22c55e;
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    bottom: -4px;
    left: 0;
    background: linear-gradient(45deg, #22c55e, #16a34a);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.nav-links a:hover::after {
    transform: scaleX(1);
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Filter Controls */
.filters {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid #333;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    justify-content: center;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-label {
    font-size: 0.9rem;
    color: #ccc;
    font-weight: 600;
}

.filter-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #444;
    border-radius: 8px;
    padding: 8px 12px;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 120px;
}

.filter-select:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

/* Fix for select dropdown visibility (z-index and background) */
.filter-select, select {
    background: #18181b;
    color: #fff;
    border: 1.5px solid #22c55e;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 1rem;
    z-index: 3001;
    position: relative;
}

select:focus {
    outline: 2px solid #22c55e;
    z-index: 4000;
}

/* Make dropdown options readable and above overlays */
select option {
    background: #23232b;
    color: #fff;
    font-size: 1rem;
    z-index: 4001;
}

/* For Chrome/Edge: force dropdown list above modals */
select {
    /* This only works for some browsers, but helps */
    position: relative;
    z-index: 4001;
}

.refresh-button {
    background: linear-gradient(45deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.refresh-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.refresh-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Leaderboard Grid */
.leaderboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 25px;
}

.leaderboard-card {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #333;
    transition: all 0.3s ease;
}

.leaderboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #444;
}

.card-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: #22c55e;
}

.card-subtitle {
    font-size: 0.8rem;
    color: #888;
}

.total-players {
    font-size: 0.8rem;
    color: #666;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
}

/* Leaderboard Entries */
.leaderboard-entries {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.entry {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;
    padding: 15px 20px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1.5px solid #333;
    transition: all 0.3s ease;
    position: relative;
    min-height: 64px;
}

.entry:hover {
    background: rgba(255, 255, 255, 0.1);
    /* Remove border-color override to let game-mode specific styles take precedence */
}

/* Game Mode Specific Entry Styles */
.entry[data-gamemode="classic"]:hover {
    border-color: var(--classic-accent);
}

.entry[data-gamemode="practice"]:hover {
    border-color: var(--practice-accent);
}

.entry[data-gamemode="hard"]:hover {
    border-color: var(--hard-accent);
}

.entry[data-gamemode="quick"]:hover {
    border-color: var(--quick-accent);
}

.entry[data-gamemode="timetrial"]:hover {
    border-color: var(--timetrial-accent);
}

.entry[data-gamemode="marathon"]:hover {
    border-color: var(--marathon-accent);
}

.entry[data-gamemode="survival"]:hover {
    border-color: var(--survival-accent);
}

.entry[data-gamemode="expert"]:hover {
    border-color: var(--expert-accent);
}

.entry.clickable {
    cursor: pointer;
    transition: all 0.3s ease, transform 0.2s ease;
    position: relative;
}

.entry.clickable::after {
    display: none;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translateX(100%); opacity: 0; }
}

.entry.clickable:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Game Mode Specific Clickable Entry Styles */
.entry.clickable[data-gamemode="classic"]:hover {
    background: rgba(34, 197, 94, 0.1);
    border-color: var(--classic-accent);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
}

.entry.clickable[data-gamemode="practice"]:hover {
    background: rgba(156, 163, 175, 0.1);
    border-color: var(--practice-accent);
    box-shadow: 0 4px 12px rgba(156, 163, 175, 0.2);
}

.entry.clickable[data-gamemode="hard"]:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--hard-accent);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.entry.clickable[data-gamemode="quick"]:hover {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--quick-accent);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.entry.clickable[data-gamemode="timetrial"]:hover {
    background: rgba(107, 114, 128, 0.1);
    border-color: var(--timetrial-accent);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.2);
}

.entry.clickable[data-gamemode="marathon"]:hover {
    background: rgba(6, 182, 212, 0.1);
    border-color: var(--marathon-accent);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.2);
}

.entry.clickable[data-gamemode="survival"]:hover {
    background: rgba(249, 115, 22, 0.1);
    border-color: var(--survival-accent);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.2);
}

.entry.clickable[data-gamemode="expert"]:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--expert-accent);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
}

.entry.top-1 {
    background: linear-gradient(45deg, rgba(255, 215, 0, 0.1), rgba(255, 193, 7, 0.1));
    border-color: #ffc107;
}

.entry.top-2 {
    background: linear-gradient(45deg, rgba(192, 192, 192, 0.1), rgba(169, 169, 169, 0.1));
    border-color: #c0c0c0;
}

.entry.top-3 {
    background: linear-gradient(45deg, rgba(205, 127, 50, 0.1), rgba(184, 115, 51, 0.1));
    border-color: #cd7f32;
}

.rank {
    font-size: 1.1rem;
    font-weight: bold;
    width: 40px;
    text-align: center;
    color: #888;
}

.rank.top-1 { color: #ffc107; }
.rank.top-2 { color: #c0c0c0; }
.rank.top-3 { color: #cd7f32; }

.player-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.player-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #333;
    object-fit: cover;
}

.player-details {
    flex: 1;
}

.player-name {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 2px;
}

.player-stats {
    font-size: 0.8rem;
    color: #888;
}

.score {
    font-size: 1.2rem;
    font-weight: bold;
    color: #fff;
    text-align: right;
    min-width: 80px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.score:hover {
    color: #fff;
    transform: scale(1.05);
}

.score-details {
    font-size: 0.7rem;
    color: #666;
    text-align: right;
}

.clickable-indicator {
    display: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Loading and Empty States */
.loading {
    text-align: center;
    padding: 40px;
    color: #888;
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #333;
    border-top: 4px solid #22c55e;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #666;
}

.empty-state p {
    font-size: 1rem;
    line-height: 1.5;
}

/* Stats Summary */
.stats-summary {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid #333;
}

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

.stat-item {
    text-align: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid #333;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #22c55e;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: #888;
}

/* High score button */
.high-score-button {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.high-score-button:hover {
    background: linear-gradient(135deg, #16a34a, #15803d);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.high-score-button:active {
    transform: translateY(0);
}

/* Game Breakdown Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-radius: 16px;
    padding: 30px;
    max-width: 98vw;
    max-height: 96vh;
    width: 1200px;
    overflow-y: auto;
    border: 2px solid #3b82f6;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #444;
}

.modal-title {
    font-size: 1.8rem;
    font-weight: bold;
    color: #fff;
}

.modal-close {
    background: none;
    border: none;
    color: #888;
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.3s ease;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #fff;
}

.game-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 1px solid #333;
}

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

.stat-label {
    font-size: 0.9rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: bold;
    color: #22c55e;
}

.rounds-container {
    margin-top: 20px;
}

.rounds-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 15px;
}

.round-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;
    padding: 15px 20px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1.5px solid #333;
    transition: all 0.3s ease;
    position: relative;
    min-height: 64px;
}

.round-item.wrong-map-round {
    border: 2px solid #ef4444;
    background: rgba(239, 68, 68, 0.10);
    box-shadow: 0 0 8px 0 #ef444455;
}

.round-item.skipped-round {
    background: #23232b;
    opacity: 0.8;
    border: 2px dashed #888;
}

.round-label {
    font-size: 1.1rem;
    font-weight: bold;
    color: #fff;
    width: 48px;
    text-align: center;
    background: rgba(0, 0, 0, 0.18);
    padding: 8px 0;
    border-radius: 6px;
    flex-shrink: 0;
}

.round-main {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-width: 120px;
}

.round-map-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 2px;
}

.round-score {
    font-size: 1.2rem;
    font-weight: bold;
    color: #22c55e;
    margin-bottom: 2px;
}

.round-item.wrong-map-round .round-score {
    color: #ef4444;
}

.round-item.poor .round-score {
    color: #ef4444;
}

.round-item.skipped-round .round-score {
    color: #bbb;
}

.round-details {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.98rem;
    color: #a0a0a0;
    flex: 2 1 0;
    min-width: 180px;
}

.round-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    min-width: 110px;
}

.wrong-map-indicator {
    color: #ef4444;
    font-weight: bold;
    font-size: 1.08rem;
    background: none;
    margin: 0;
    padding: 0;
    text-align: left;
}

.skipped-indicator {
    color: #bbb;
    font-size: 1.08rem;
    font-weight: 600;
    background: #333;
    border-radius: 6px;
    padding: 2px 10px;
    margin-left: 0;
    display: inline-block;
}

@media (max-width: 900px) {
    .round-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 12px 8px;
    }
    .round-actions {
        align-items: flex-start;
        min-width: 0;
    }
}

/* Game Mode Specific Round Item Styles */
.modal-content[data-gamemode="classic"] .round-item.perfect {
    border-left-color: var(--classic-accent);
    background: rgba(34, 197, 94, 0.1);
}

.modal-content[data-gamemode="practice"] .round-item.perfect {
    border-left-color: var(--practice-accent);
    background: rgba(156, 163, 175, 0.1);
}

.modal-content[data-gamemode="hard"] .round-item.perfect {
    border-left-color: var(--hard-accent);
    background: rgba(239, 68, 68, 0.1);
}

.modal-content[data-gamemode="quick"] .round-item.perfect {
    border-left-color: var(--quick-accent);
    background: rgba(245, 158, 11, 0.1);
}

.modal-content[data-gamemode="timetrial"] .round-item.perfect {
    border-left-color: var(--timetrial-accent);
    background: rgba(107, 114, 128, 0.1);
}

.modal-content[data-gamemode="marathon"] .round-item.perfect {
    border-left-color: var(--marathon-accent);
    background: rgba(6, 182, 212, 0.1);
}

.modal-content[data-gamemode="survival"] .round-item.perfect {
    border-left-color: var(--survival-accent);
    background: rgba(249, 115, 22, 0.1);
}

.modal-content[data-gamemode="expert"] .round-item.perfect {
    border-left-color: var(--expert-accent);
    background: rgba(139, 92, 246, 0.1);
}

.round-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.round-number {
    font-size: 1.1rem;
    font-weight: bold;
    color: #fff;
    width: 60px;
    text-align: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px;
    border-radius: 6px;
}

.round-map {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 3px;
}

.round-meta {
    font-size: 0.8rem;
    color: #888;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.round-score {
    font-size: 1.2rem;
    font-weight: bold;
    color: #22c55e;
    text-align: right;
    min-width: 80px;
}

.round-score.skipped {
    color: #f59e0b;
}

.round-score.poor {
    color: #ef4444;
}

.view-map-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 10px;
}

.view-map-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.view-map-btn:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
}

/* Game Mode Specific View Map Button Styles */
.modal-content[data-gamemode="classic"] .view-map-btn {
    background: linear-gradient(135deg, var(--classic-accent), #16a34a);
}

.modal-content[data-gamemode="classic"] .view-map-btn:hover:not(:disabled) {
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.modal-content[data-gamemode="practice"] .view-map-btn {
    background: linear-gradient(135deg, var(--practice-accent), #6b7280);
}

.modal-content[data-gamemode="practice"] .view-map-btn:hover:not(:disabled) {
    box-shadow: 0 2px 8px rgba(156, 163, 175, 0.3);
}

.modal-content[data-gamemode="hard"] .view-map-btn {
    background: linear-gradient(135deg, var(--hard-accent), #dc2626);
}

.modal-content[data-gamemode="hard"] .view-map-btn:hover:not(:disabled) {
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.modal-content[data-gamemode="quick"] .view-map-btn {
    background: linear-gradient(135deg, var(--quick-accent), #d97706);
}

.modal-content[data-gamemode="quick"] .view-map-btn:hover:not(:disabled) {
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.modal-content[data-gamemode="timetrial"] .view-map-btn {
    background: linear-gradient(135deg, var(--timetrial-accent), #4b5563);
}

.modal-content[data-gamemode="timetrial"] .view-map-btn:hover:not(:disabled) {
    box-shadow: 0 2px 8px rgba(107, 114, 128, 0.3);
}

.modal-content[data-gamemode="marathon"] .view-map-btn {
    background: linear-gradient(135deg, var(--marathon-accent), #0891b2);
}

.modal-content[data-gamemode="marathon"] .view-map-btn:hover:not(:disabled) {
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}

.modal-content[data-gamemode="survival"] .view-map-btn {
    background: linear-gradient(135deg, var(--survival-accent), #ea580c);
}

.modal-content[data-gamemode="survival"] .view-map-btn:hover:not(:disabled) {
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3);
}

.modal-content[data-gamemode="expert"] .view-map-btn {
    background: linear-gradient(135deg, var(--expert-accent), #7c3aed);
}

.modal-content[data-gamemode="expert"] .view-map-btn:hover:not(:disabled) {
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

/* Map Viewer Modal */
.map-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

.map-modal.show {
    display: flex;
}

.map-modal-content {
    background: #1a1a1a;
    border-radius: 16px;
    padding: 20px;
    max-width: 95vw;
    max-height: 95vh;
    overflow: hidden;
    border: 2px solid #444;
}

.map-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.map-modal-title {
    font-size: 1.4rem;
    font-weight: bold;
    color: #fff;
}

.map-comparison {
    position: relative;
}

.single-map-view .map-display-container {
    position: relative;
    width: 600px;
    height: 600px;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
}

.side-by-side-view {
    display: flex;
    justify-content: center;
}

.map-comparison-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.map-side {
    text-align: center;
}

.map-side-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 10px;
    padding: 8px 16px;
    border-radius: 8px;
    display: inline-block;
}

.map-side-title.guess-title {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.map-side-title.correct-title {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.map-side .map-display-container {
    position: relative;
    width: 400px;
    height: 400px;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #333;
}

.map-name {
    margin-top: 10px;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    display: inline-block;
}

.map-display-container {
    position: relative;
    width: 600px;
    height: 600px;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
}

.map-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.map-marker {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    transform: translate(-50%, -50%);
    z-index: 10;
    animation: markerPulse 2s infinite;
}

.map-marker.guess {
    background: #22c55e;
}

.map-marker.answer {
    background: #ef4444;
}

@keyframes markerPulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 20px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    margin-top: 50px;
    border-top: 1px solid #333;
}

.footer p {
    color: #666;
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .leaderboard-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-select {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .logo {
        font-size: 2rem;
    }
    
    .auth-panel {
        position: static;
        justify-content: center;
        margin-bottom: 20px;
        flex-wrap: wrap;
    }
    
    .auth-status {
        flex-direction: column;
        text-align: center;
        order: 1;
    }

    .auth-buttons {
        order: 2;
        margin-top: 10px;
    }
    
    /* Mobile map display */
    .map-comparison-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .map-side .map-display-container {
        width: 300px;
        height: 300px;
    }
    
    .single-map-view .map-display-container {
        width: 350px;
        height: 350px;
    }
}

/* ===============================================
   Game Mode Color Overrides
   =============================================== */

/* Classic Mode (Green) - Default */
/* No overrides needed as green is the default */

/* Practice Mode (Light Gray) */
body[data-gamemode="practice"] .user-avatar {
    border-color: var(--practice-accent);
}

body[data-gamemode="practice"] .nav-links a.active {
    color: var(--practice-accent);
}

body[data-gamemode="practice"] .nav-links a::after {
    background: linear-gradient(45deg, var(--practice-accent), #6b7280);
}

body[data-gamemode="practice"] .filter-select:focus {
    border-color: var(--practice-accent);
    box-shadow: 0 0 0 2px rgba(156, 163, 175, 0.2);
}

body[data-gamemode="practice"] .score {
    color: var(--practice-accent);
}

body[data-gamemode="practice"] .stat-card.active {
    border-top-color: var(--practice-accent);
}

body[data-gamemode="practice"] .stat-card.active .stat-value {
    color: var(--practice-accent);
}

body[data-gamemode="practice"] .map-item.active {
    border-left-color: var(--practice-accent);
}

body[data-gamemode="practice"] .map-item.active .map-name {
    color: var(--practice-accent);
}

body[data-gamemode="practice"] .modal-backdrop .close-button {
    color: var(--practice-accent);
}

body[data-gamemode="practice"] .score-breakdown .perfect {
    background: var(--practice-accent);
}

/* Hard Mode (Red) */
body[data-gamemode="hard"] .user-avatar {
    border-color: var(--hard-accent);
}

body[data-gamemode="hard"] .nav-links a.active {
    color: var(--hard-accent);
}

body[data-gamemode="hard"] .nav-links a::after {
    background: linear-gradient(45deg, var(--hard-accent), #dc2626);
}

body[data-gamemode="hard"] .filter-select:focus {
    border-color: var(--hard-accent);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

body[data-gamemode="hard"] .score-display {
    color: var(--hard-accent);
}

body[data-gamemode="hard"] .stat-card.active {
    border-top-color: var(--hard-accent);
}

body[data-gamemode="hard"] .stat-card.active .stat-value {
    color: var(--hard-accent);
}

body[data-gamemode="hard"] .map-item.active {
    border-left-color: var(--hard-accent);
}

body[data-gamemode="hard"] .map-item.active .map-name {
    color: var(--hard-accent);
}

body[data-gamemode="hard"] .modal-backdrop .close-button {
    color: var(--hard-accent);
}

body[data-gamemode="hard"] .score-breakdown .perfect {
    background: var(--hard-accent);
}

/* Quick Mode (Yellow) */
body[data-gamemode="quick"] .user-avatar {
    border-color: var(--quick-accent);
}

body[data-gamemode="quick"] .nav-links a.active {
    color: var(--quick-accent);
}

body[data-gamemode="quick"] .nav-links a::after {
    background: linear-gradient(45deg, var(--quick-accent), #d97706);
}

body[data-gamemode="quick"] .filter-select:focus {
    border-color: var(--quick-accent);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

body[data-gamemode="quick"] .score-display {
    color: var(--quick-accent);
}

body[data-gamemode="quick"] .stat-card.active {
    border-top-color: var(--quick-accent);
}

body[data-gamemode="quick"] .stat-card.active .stat-value {
    color: var(--quick-accent);
}

body[data-gamemode="quick"] .map-item.active {
    border-left-color: var(--quick-accent);
}

body[data-gamemode="quick"] .map-item.active .map-name {
    color: var(--quick-accent);
}

body[data-gamemode="quick"] .modal-backdrop .close-button {
    color: var(--quick-accent);
}

body[data-gamemode="quick"] .score-breakdown .perfect {
    background: var(--quick-accent);
}

/* Time Trial Mode (Dark Gray) */
body[data-gamemode="timetrial"] .user-avatar {
    border-color: var(--timetrial-accent);
}

body[data-gamemode="timetrial"] .nav-links a.active {
    color: var(--timetrial-accent);
}

body[data-gamemode="timetrial"] .nav-links a::after {
    background: linear-gradient(45deg, var(--timetrial-accent), #4b5563);
}

body[data-gamemode="timetrial"] .filter-select:focus {
    border-color: var(--timetrial-accent);
    box-shadow: 0 0 0 2px rgba(107, 114, 128, 0.2);
}

body[data-gamemode="timetrial"] .score-display {
    color: var(--timetrial-accent);
}

body[data-gamemode="timetrial"] .stat-card.active {
    border-top-color: var(--timetrial-accent);
}

body[data-gamemode="timetrial"] .stat-card.active .stat-value {
    color: var(--timetrial-accent);
}

body[data-gamemode="timetrial"] .map-item.active {
    border-left-color: var(--timetrial-accent);
}

body[data-gamemode="timetrial"] .map-item.active .map-name {
    color: var(--timetrial-accent);
}

body[data-gamemode="timetrial"] .modal-backdrop .close-button {
    color: var(--timetrial-accent);
}

body[data-gamemode="timetrial"] .score-breakdown .perfect {
    background: var(--timetrial-accent);
}

/* Marathon Mode (Cyan) */
body[data-gamemode="marathon"] .user-avatar {
    border-color: var(--marathon-accent);
}

body[data-gamemode="marathon"] .nav-links a.active {
    color: var(--marathon-accent);
}

body[data-gamemode="marathon"] .nav-links a::after {
    background: linear-gradient(45deg, var(--marathon-accent), #0891b2);
}

body[data-gamemode="marathon"] .filter-select:focus {
    border-color: var(--marathon-accent);
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

body[data-gamemode="marathon"] .score-display {
    color: var(--marathon-accent);
}

body[data-gamemode="marathon"] .stat-card.active {
    border-top-color: var(--marathon-accent);
}

body[data-gamemode="marathon"] .stat-card.active .stat-value {
    color: var(--marathon-accent);
}

body[data-gamemode="marathon"] .map-item.active {
    border-left-color: var(--marathon-accent);
}

body[data-gamemode="marathon"] .map-item.active .map-name {
    color: var(--marathon-accent);
}

body[data-gamemode="marathon"] .modal-backdrop .close-button {
    color: var(--marathon-accent);
}

body[data-gamemode="marathon"] .score-breakdown .perfect {
    background: var(--marathon-accent);
}

/* Survival Mode (Orange) */
body[data-gamemode="survival"] .user-avatar {
    border-color: var(--survival-accent);
}

body[data-gamemode="survival"] .nav-links a.active {
    color: var(--survival-accent);
}

body[data-gamemode="survival"] .nav-links a::after {
    background: linear-gradient(45deg, var(--survival-accent), #ea580c);
}

body[data-gamemode="survival"] .filter-select:focus {
    border-color: var(--survival-accent);
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2);
}

body[data-gamemode="survival"] .score-display {
    color: var(--survival-accent);
}

body[data-gamemode="survival"] .stat-card.active {
    border-top-color: var(--survival-accent);
}

body[data-gamemode="survival"] .stat-card.active .stat-value {
    color: var(--survival-accent);
}

body[data-gamemode="survival"] .map-item.active {
    border-left-color: var(--survival-accent);
}

body[data-gamemode="survival"] .map-item.active .map-name {
    color: var(--survival-accent);
}

body[data-gamemode="survival"] .modal-backdrop .close-button {
    color: var(--survival-accent);
}

body[data-gamemode="survival"] .score-breakdown .perfect {
    background: var(--survival-accent);
}

/* Expert Mode (Purple) */
body[data-gamemode="expert"] .user-avatar {
    border-color: var(--expert-accent);
}

body[data-gamemode="expert"] .nav-links a.active {
    color: var(--expert-accent);
}

body[data-gamemode="expert"] .nav-links a::after {
    background: linear-gradient(45deg, var(--expert-accent), #7c3aed);
}

body[data-gamemode="expert"] .filter-select:focus {
    border-color: var(--expert-accent);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

body[data-gamemode="expert"] .score-display {
    color: var(--expert-accent);
}

body[data-gamemode="expert"] .stat-card.active {
    border-top-color: var(--expert-accent);
}

body[data-gamemode="expert"] .stat-card.active .stat-value {
    color: var(--expert-accent);
}

body[data-gamemode="expert"] .map-item.active {
    border-left-color: var(--expert-accent);
}

body[data-gamemode="expert"] .map-item.active .map-name {
    color: var(--expert-accent);
}

body[data-gamemode="expert"] .modal-backdrop .close-button {
    color: var(--expert-accent);
}

body[data-gamemode="expert"] .score-breakdown .perfect {
    background: var(--expert-accent);
}

/* Score Modal Styles */
.score-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2001;
    animation: fadeIn 0.3s ease;
}

.score-modal.show {
    display: flex;
}

.score-modal-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-radius: 16px;
    padding: 25px;
    max-width: 500px;
    width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    border: 2px solid #3b82f6;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
    position: relative;
}

.score-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #444;
}

.score-modal-title {
    color: #fff;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0;
}

.score-summary-content {
    color: #fff;
}

.score-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #333;
}

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

.score-stat-label {
    font-size: 1rem;
    color: #ccc;
}

.score-stat-value {
    font-size: 1.1rem;
    font-weight: bold;
    color: #fff;
}

.score-rank {
    text-align: center;
    margin: 15px 0;
    padding: 15px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 8px;
    border: 1px solid #3b82f6;
}

.score-rank-title {
    font-size: 0.9rem;
    color: #ccc;
    margin-bottom: 5px;
}

.score-rank-value {
    font-size: 2rem;
    font-weight: bold;
    color: #3b82f6;
}

.score-rank-medal {
    font-size: 3rem;
    margin-bottom: 10px;
}

/* ===============================================
   Inline Map Display Styles
   =============================================== */

.inline-map-display {
    margin-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 15px;
}

.inline-map-display h4 {
    font-size: 14px;
    margin-bottom: 10px;
    color: #e5e7eb;
    text-align: center;
}

/* Single Map Display */
.inline-map-display.single-map .map-container {
    max-width: 400px;
    margin: 0 auto;
}

/* Side-by-Side Map Comparison */
.inline-map-display.side-by-side .map-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.map-container {
    position: relative;
}

.map-wrapper {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.round-map-image {
    width: 100%;
    height: auto;
    max-height: 250px;
    object-fit: cover;
    display: block;
}

/* Map Pins */
.map-pin {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    transform: translate(-50%, -50%);
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    animation: pulse 2s infinite;
}

.map-pin.guess-pin {
    background: #22c55e;
    border-color: #16a34a;
}

.map-pin.correct-pin {
    background: #ef4444;
    border-color: #dc2626;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(34, 197, 94, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

.map-pin.correct-pin {
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Map Container Labels */
.guess-map h4 {
    color: #22c55e;
}

.correct-map h4 {
    color: #ef4444;
}

/* View Large Button */
.view-map-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #e5e7eb;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 10px;
}

.view-map-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* Responsive Design for Maps */
@media (max-width: 768px) {
    .inline-map-display.side-by-side .map-comparison {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .round-map-image {
        max-height: 200px;
    }
    
    .map-pin {
        width: 10px;
        height: 10px;
    }
}

/* Round header layout to match screenshot */
.round-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 8px;
}

.round-number {
    font-size: 18px;
    font-weight: bold;
    color: #22c55e;
    min-width: 40px;
}

.round-map-name {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    flex-grow: 1;
    margin-left: 15px;
}

.round-details {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 0 15px;
    margin-bottom: 10px;
}

.round-detail {
    font-size: 14px;
    color: #a0a0a0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.round-item.skipped .round-number {
    color: #f59e0b;
}

.round-item.perfect .round-number {
    color: #10b981;
}

.round-item.poor .round-number {
    color: #ef4444;
}

.round-item.wrong-map-round {
    border: 2px solid #ef4444;
    background: rgba(239, 68, 68, 0.08);
    box-shadow: 0 0 8px 0 #ef444455;
}

.round-item .wrong-map-indicator {
    color: #ef4444;
    font-weight: bold;
    margin-top: 0px;
    font-size: 1rem;
    text-align: right;
}

.round-item.skipped-round {
    background: #23232b;
    opacity: 0.7;
    border: 2px dashed #888;
}

.skipped-indicator {
    color: #bbb;
    font-size: 1.1rem;
    font-weight: 600;
    background: #333;
    border-radius: 6px;
    padding: 2px 10px;
    margin-left: 8px;
}

/* ...existing code... */
