:root {
    --bg-primary: #1e1e1e;
    --bg-secondary: #2d2d30;
    --bg-card: #252526;
    --text-primary: #d4d4d4;
    --text-secondary: #969696;
    --accent-blue: #007acc;
    --accent-green: #4ec9b0;
    --accent-orange: #ce9178;
    --rank-gold: #ffd700;
    --rank-silver: #E5E4E2;
    --rank-bronze: #CD7F32;
    --shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin: 20px 0 40px;
}

.logo {
    font-size: 3.5rem;
    margin-bottom: 10px;
    color: var(--accent-green);
}

h1 {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.subtitle {
    font-size: 1.2rem;
    font-weight: 300;
    max-width: 600px;
    margin: 0 auto;
    color: var(--text-secondary);
}

.top-three {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.podium-card {
    background: var(--bg-card);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 30px 20px;
    text-align: center;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid var(--bg-secondary);
}

.podium-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.6);
}

/* -- Enhanced Top Three Styling -- */
.first-place {
    width: 340px;
    order: 2;
    margin: 0 10px;
    background: linear-gradient(135deg, var(--bg-card) 0%, #3a3a3a 100%);
    border: 2px solid var(--rank-gold);
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.4), var(--shadow);
    position: relative;
    overflow: hidden;
}

.first-place::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(255, 215, 0, 0.1) 0%, transparent 70%);
    animation: shimmer 6s infinite linear;
    z-index: 0;
}

@keyframes shimmer {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.second-place, .third-place {
    width: 300px;
    background: linear-gradient(135deg, var(--bg-card) 0%, #2f2f2f 100%);
    border: 1px solid;
}

.second-place {
    order: 1;
    border-color: var(--rank-silver);
    box-shadow: 0 0 15px rgba(192, 192, 192, 0.3);
}

.third-place {
    order: 3;
    border-color: var(--rank-bronze);
    box-shadow: 0 0 15px rgba(205, 127, 50, 0.3);
}

.first-place .rank-badge {
    background-color: var(--rank-gold);
    color: #2c3e50;
    width: 60px;
    height: 60px;
    font-size: 2rem;
    box-shadow: 0 0 15px var(--rank-gold);
    position: relative;
    z-index: 2; /* Ensure it's above the shimmer */
}

.second-place .rank-badge {
    background-color: var(--rank-silver);
    color: #2c3e50;
    box-shadow: 0 0 10px var(--rank-silver);
}

.third-place .rank-badge {
    background-color: var(--rank-bronze);
    color: #2c3e50;
    box-shadow: 0 0 10px var(--rank-bronze);
}

.first-place .player-name {
    font-size: 1.8rem;
    color: var(--rank-gold);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    position: relative;
    z-index: 2;
}

.second-place .player-name {
    color: var(--rank-silver);
}

.third-place .player-name {
    color: var(--rank-bronze);
}

.first-place .stat-value {
    font-size: 1.8rem;
    color: var(--text-primary);
}
/* -- End Enhanced Top Three Styling -- */
.rank-badge {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 auto 20px;
    color: #2c3e50;
}

.rank-1 {
    background-color: var(--rank-gold);
    width: 55px;
    height: 55px;
    font-size: 1.8rem;
}

.rank-2 {
    background-color: var(--rank-silver);
}

.rank-3 {
    background-color: var(--rank-bronze);
}

.avatar-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    margin: 0 auto 20px;
    height: 130px;
}

.trainer-avatar, .focumon-avatar {
    height: 128px;
    width: auto;
    object-fit: contain;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.focumon-avatar {
    margin-left: -20px;
}

.player-name {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}


.player-stats {
    display: flex;
    justify-content: space-around;
    width: 100%;
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Source Code Pro', monospace;
}



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

.leaderboard-card {
    background: var(--bg-card);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 30px;
    border: 1px solid var(--bg-secondary);
}

.leaderboard-header {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.leaderboard-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.last-updated {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    color: var(--text-secondary);
}

.last-updated i {
    margin-right: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background-color: var(--bg-secondary);
    padding: 18px 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--bg-primary);
}

th:nth-child(1) { width: 8%; }
th:nth-child(2) { width: 32%; }
th:nth-child(3) { width: 20%; }
th:nth-child(4) { width: 20%; }
th:nth-child(5) { width: 20%; }

td {
    padding: 16px 15px;
    border-bottom: 1px solid var(--bg-secondary);
    transition: var(--transition);
    color: var(--text-primary);
}

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

tr:hover td {
    background-color: #3c3c3c;
}

.rank {
    font-weight: 700;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.table-rank {
    font-weight: 700;
    text-align: center;
    display: inline-block;
    width: 30px;
    height: 30px;
    line-height: 30px;
    border-radius: 50%;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    margin-right: 15px;
    object-fit: cover;
    background-color: var(--bg-secondary);
    border: 2px solid var(--accent-blue);
}

.avatar-placeholder {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-weight: 600;
    margin-right: 15px;
    font-size: 1.2rem;
}

.player {
    display: flex;
    align-items: center;
}

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

.flowers, .hours {
    font-weight: 500;
    color: var(--text-primary);
    font-family: 'Source Code Pro', monospace;
}

.rank-change {
    font-weight: 700;
    font-family: 'Source Code Pro', monospace;
}

.rank-change.positive {
    color: var(--accent-green);
}

.rank-change.negative {
    color: var(--accent-orange);
}

.rank-change.neutral {
    color: var(--text-secondary);
}

.progress-bar {
    height: 8px;
    background-color: var(--bg-secondary);
    border-radius: 4px;
    margin-top: 8px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: linear-gradient(to right, var(--accent-blue), var(--accent-green));
    border-radius: 4px;
}

.stats {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
    flex-wrap: wrap;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 20px;
    margin: 10px;
    flex: 1;
    min-width: 250px;
    box-shadow: var(--shadow);
    text-align: center;
    border: 1px solid var(--bg-secondary);
}

.stat-card i {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: var(--accent-blue);
}

.stat-card h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.stat-card p {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Source Code Pro', monospace;
}

footer {
    text-align: center;
    margin-top: 40px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

footer .fa-heart {
    color: #e74c3c;
}

@media (max-width: 900px) {
    .top-three {
        flex-direction: column;
        align-items: center;
    }
    
    .first-place, .second-place, .third-place {
        width: 100%;
        max-width: 400px;
        margin: 10px 0;
        order: unset;
    }
}

@media (max-width: 768px) {
    th, td {
        padding: 12px 8px;
    }
    
    .leaderboard-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .avatar, .avatar-placeholder {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    h1 {
        font-size: 2.2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
}

@media (max-width: 576px) {
    body {
        padding: 10px;
    }
    
    th:nth-child(1), td:nth-child(1) {
        display: none;
    }
    
    .stats {
        flex-direction: column;
    }
}

/* Add to style.css */
.danger-zone {
    background-color: #1a1a1a !important;
    position: relative;
}

.danger-zone:hover {
    background-color: #1f1f1f !important;
}

.danger-zone td {
    color: #ff4444 !important;
}

.danger-zone .avatar,
.danger-zone .avatar-placeholder {
    border-color: #FF9D00 !important;
}

.danger-zone .progress {
    background: #FF9D00 !important;
}

.danger-icon {
    color: #ff4444;
    margin-left: 8px;
    font-size: 0.9em;
}

.danger-zone .player-name-text::after {
    content: " ⚠️";
}

/* Tooltip styling */
.danger-zone {
    position: relative;
}

.danger-zone::after {
    content: "Challenge: You're close! Focus to break past 75!";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #FF9D00;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 100;
}

.danger-zone:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Add to style.css */
.player-title {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 4px;
}

/* For top three cards */
.podium-card .player-title {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.first-place .player-title {
    color: var(--rank-gold);
}

.second-place .player-title {
    color: var(--rank-silver);
}

.third-place .player-title {
    color: var(--rank-bronze);
}