:root {
    /* Palette: Deep Black, Dark Gray, and Vibrant Green */
    --bg-base: #0d0d0d;
    --bg-pattern-line: #1a1a1a; 
    
    --main-card-bg: #141414;
    --inner-card-bg: #1e1e1e;
    --inner-card-hover: #262626;
    
    --text-main: #ffffff;
    --text-muted: #94a3b8;
    --accent: #4ade80; 
    --border-muted: #2a2a2a;
    --border-radius-lg: 24px;
    --border-radius-md: 16px;
}

/* --- Global Resets --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 4rem 2rem;
    color: var(--text-main);
    background-color: var(--bg-base);
    background-image:
        linear-gradient(90deg, var(--bg-pattern-line) 1px, transparent 1px),
        linear-gradient(0deg, var(--bg-pattern-line) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* --- Main Wrapper --- */
.main-wrapper-card {
    background-color: var(--main-card-bg);
    border: 1px solid var(--border-muted);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 1100px;
    padding: 4rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 { 
    font-size: 3.5rem; 
    font-weight: 800; 
    letter-spacing: -2px; 
}

header p { 
    color: var(--text-muted); 
    font-size: 1.2rem; 
    margin-top: 0.5rem; 
}

/* --- Dashboard Layout --- */
.dashboard-wrapper {
    display: flex;
    flex-direction: column;
    gap: 3rem; 
}

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

.master-list-row {
    width: 100%;
}

/* --- Leaderboard & Card Layout --- */
.leaderboard {
    background-color: var(--inner-card-bg);
    border: 1px solid var(--border-muted);
    border-radius: var(--border-radius-md);
    padding: 2.5rem;
}

.leaderboard h3 {
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-muted);
    font-size: 1.4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 12px; /* Space between cards */
}

/* Individual Rank Card */
.rank-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-muted);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.rank-card:hover {
    background-color: var(--inner-card-hover);
    border-color: var(--accent);
    transform: translateX(5px);
}

/* Left Section: Number and Identity */
.rank-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    min-width: 0;
}

.rank-number {
    font-weight: 800;
    color: var(--text-muted);
    width: 25px;
}

.rank-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rank-name {
    font-weight: 700;
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Right Section: Stats Group */
.rank-stats {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.rank-change {
    width: 70px;
    text-align: right;
    font-size: 0.85rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.rank-change.up { color: var(--accent); }
.rank-change.down { color: #f87171; }
.rank-change.neutral { color: var(--text-muted); opacity: 0.4; }

.rank-score { 
    color: var(--accent); 
    font-weight: 800; 
    font-size: 1.1rem;
    width: 60px;
    text-align: right;
    font-variant-numeric: tabular-nums; 
}

/* --- UI Elements --- */
.play-button-container { 
    display: flex; 
    justify-content: center; 
    margin-top: 1rem; 
    margin-bottom: 2rem; 
}

.play-button {
    background-color: var(--accent);
    color: var(--bg-base);
    text-decoration: none;
    font-weight: 800;
    padding: 1rem 3rem;
    border-radius: var(--border-radius-md);
    transition: 0.3s;
}

.play-button:hover { 
    transform: translateY(-3px); 
    box-shadow: 0 10px 20px rgba(74, 222, 128, 0.2); 
}

.category-tag {
    padding: 0.2rem 0.7rem;
    background: rgba(74, 222, 128, 0.1);
    border-radius: 12px;
    font-size: 0.7rem;
    color: var(--accent);
    text-transform: uppercase;
}

.category-tag-small {
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    color: var(--text-muted);
    width: fit-content;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Responsiveness --- */
@media (max-width: 768px) {
    .main-wrapper-card { padding: 2rem 1.5rem; }
    header h1 { font-size: 2.5rem; }
    .category-row { grid-template-columns: 1fr; }
    .rank-stats { gap: 1rem; }
    .rank-change { width: 50px; }
}