:root {
    --bg-color: #0b0f19;
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --card-bg: rgba(30, 41, 59, 0.5);
    --card-border: rgba(255, 255, 255, 0.1);
    --global-gradient: linear-gradient(135deg, rgba(255,107,107,0.8) 0%, rgba(138,35,135,0.8) 100%);
    --rank-up: #10b981;
    --rank-down: #ef4444;
}

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

body {
    font-family: 'Outfit', 'Noto Sans SC', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    filter: blur(120px);
    border-radius: 50%;
    opacity: 0.4;
    animation: float 20s infinite alternate ease-in-out;
}

.blob-1 {
    top: -10%; left: -10%; width: 50vw; height: 50vw;
    background: radial-gradient(circle, #3b82f6, #8b5cf6);
}

.blob-2 {
    bottom: -10%; right: -10%; width: 40vw; height: 40vw;
    background: radial-gradient(circle, #ec4899, #f43f5e);
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(10%, 10%) scale(1.1); }
}

.container {
    width: 85%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

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

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p { color: var(--text-secondary); font-size: 1rem; }

/* Tabs & Filters */
.tabs, .filters {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.tab-btn, .filter-btn {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    padding: 0.6rem 1.2rem;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.tab-btn:hover, .filter-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.tab-btn.active, .filter-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

/* List View */
.list-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* List Item Row */
.list-item {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    backdrop-filter: blur(12px);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
    animation: fadeInUp 0.5s ease backwards;
}

.list-item:hover {
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    border-color: rgba(255,255,255,0.2);
}

.list-item.global-featured {
    background: var(--global-gradient);
    border: none;
}

.row-main {
    display: flex;
    align-items: center;
    padding: 1.2rem;
    cursor: pointer;
}

.col-info {
    flex: 1;
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.country-flag {
    font-size: 1.3rem;
    font-weight: 800;
    width: 3rem;
    text-align: center;
    line-height: normal;
}

.country-name {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: normal;
    display: block;
}
.game-name { display: none; }

.col-rank {
    width: 80px;
    text-align: center;
}
.rank-badge {
    display: inline-block;
    font-size: 1.5rem;
    font-weight: 800;
    background: rgba(255,255,255,0.1);
    padding: 0.3rem 0.8rem;
    border-radius: 8px;
    color: #fff;
}

.col-trend {
    width: 250px;
    height: 40px;
    margin: 0 1.5rem;
    pointer-events: none;
}

.col-arrow {
    width: 30px;
    text-align: center;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

.list-item.expanded .col-arrow {
    transform: rotate(180deg);
}

/* Expanded Detail Section */
.row-detail {
    display: none;
    padding: 1.5rem;
    background: rgba(0,0,0,0.2);
    border-top: 1px solid var(--card-border);
}

.list-item.expanded .row-detail {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn 0.3s ease;
}

.detail-chart-wrapper {
    position: relative;
    height: 250px;
    width: 100%;
}

/* Top 100 List Styles */
.detail-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}

.top100-toggle {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.top100-container {
    display: none;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.top100-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.5rem;
}

.locate-btn {
    background: rgba(255,255,255,0.1);
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.locate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.top100-list {
    list-style: none;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.top100-item {
    display: flex;
    padding: 0.6rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    align-items: center;
}

.top100-item.highlight {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 4px;
    border-left: 4px solid var(--accent);
}

.top100-rank {
    width: 40px;
    font-weight: bold;
    color: var(--text-secondary);
}

.top100-name {
    flex: 1;
}

/* Custom Scrollbar */
.top100-list::-webkit-scrollbar {
    width: 6px;
}
.top100-list::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
}
.top100-list::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 10px;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .container { width: 95%; padding: 1rem; }
    .col-trend { display: none; }
    .col-info { flex: 2; }
    .row-main { padding: 1rem 0.5rem; }
    
    .list-item.expanded .row-detail {
        padding: 1rem 0.5rem;
    }
    
    .top100-list {
        max-height: 300px;
    }
}

/* Loading Spinner */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: white;
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 1px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
