:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary: #38bdf8;
    --secondary: #818cf8;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #f472b6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background: radial-gradient(circle at top right, #1e1b4b, #0f172a);
    color: var(--text-main);
    min-height: 100vh;
    padding: 2rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    margin-bottom: 3rem;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-muted);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    border-radius: 1rem;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 0.5rem;
    color: var(--primary);
}

/* Charts Section */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.chart-container {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: 1rem;
    min-height: 400px;
}

h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Class Table */
.data-section {
    margin-top: 3rem;
}

.table-wrapper {
    background: var(--card-bg);
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid var(--glass-border);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-weight: 600;
}

tr:last-child td {
    border-bottom: none;
}

.gain-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.gain-high {
    background: #065f46;
    color: #34d399;
}

.gain-med {
    background: #92400e;
    color: #fbbf24;
}

.gain-low {
    background: #991b1b;
    color: #f87171;
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }
}

/* CSS for Top 3 Leaderboard */
.leaderboard-container {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.9));
    border: 1px solid rgba(255, 215, 0, 0.2);
    padding: 2rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.leaderboard-title {
    font-size: 1.5rem;
    color: #fbbf24;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 1rem;
    height: 200px;
}

.podium-place {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100px;
}

.avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    border: 2px solid transparent;
}

.bar {
    width: 100%;
    border-radius: 0.5rem 0.5rem 0 0;
    position: relative;
    transition: height 1s ease-out;
    background: linear-gradient(to bottom, #475569, #1e293b);
}

.rank-1 .avatar {
    border-color: #fbbf24;
    color: #fbbf24;
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.4);
}

.rank-1 .bar {
    height: 120px;
    background: linear-gradient(to bottom, #fbbf24, #b45309);
}

.rank-1 {
    order: 2;
}

.rank-2 .avatar {
    border-color: #94a3b8;
    color: #94a3b8;
}

.rank-2 .bar {
    height: 90px;
    background: linear-gradient(to bottom, #94a3b8, #475569);
}

.rank-2 {
    order: 1;
}

.rank-3 .avatar {
    border-color: #b45309;
    color: #b45309;
}

.rank-3 .bar {
    height: 70px;
    background: linear-gradient(to bottom, #b45309, #78350f);
}

.rank-3 {
    order: 3;
}

.player-name {
    margin-top: 0.5rem;
    font-weight: bold;
    font-size: 0.9rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

/* Countdown Overlay */
.locked-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.95);
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.countdown-timer {
    font-size: 4rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: #38bdf8;
    text-shadow: 0 0 20px rgba(56, 189, 248, 0.5);
    margin: 1rem 0;
}

.admin-panel-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    opacity: 0.3;
    transition: opacity 0.3s;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: #cbd5e1;
    font-size: 0.9rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 0.5rem;
    color: #fff;
    font-size: 1rem;
}

.modal-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
}

.btn-primary {
    background: var(--primary);
    color: #0f172a;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    flex: 1;
}

.btn-secondary {
    background: transparent;
    border: 1px solid #334155;
    color: #94a3b8;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    flex: 1;
}

.hidden {
    display: none !important;
}