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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #2c3e50;
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 40px;
    backdrop-filter: blur(10px);
}

h1 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 2.5rem;
    font-weight: 300;
    color: #34495e;
}

h1 a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

h1 a:hover {
    color: #3498db;
}

h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.5rem;
    font-weight: 500;
    position: relative;
}

h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    border-radius: 2px;
}

.stats-info {
    text-align: center;
    margin-bottom: 30px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e8f4fd;
}

.stats-info p {
    color: #34495e;
    font-size: 1.1rem;
    font-weight: 500;
}

.timestamp-link {
    color: inherit;
    text-decoration: none;
    transition: text-decoration 0.3s ease;
}

.timestamp-link:hover {
    text-decoration: underline;
}

.stats-controls {
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    border: 1px solid #e8f4fd;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.tab-btn {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: #6c757d;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.tab-btn.active {
    background: #3498db;
    border-color: #3498db;
    color: white;
}

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

#search-input {
    flex: 1;
    min-width: 200px;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

#search-input:focus {
    outline: none;
    border-color: #3498db;
}

#sort-select {
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

#sort-select:focus {
    outline: none;
    border-color: #3498db;
}

.stats-content {
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    border: 1px solid #e8f4fd;
    min-height: 400px;
}

.loading-message {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 60px;
    font-size: 1.2rem;
}

.error-message,
.noscript-message {
    text-align: center;
    padding: 60px;
}

.error-message h2,
.noscript-message h2 {
    color: #e74c3c;
    margin-bottom: 20px;
}

.error-message p,
.noscript-message p {
    color: #7f8c8d;
    font-size: 1.1rem;
}

.stats-table {
    width: 100%;
}

.item-name {
    flex: 1;
}

.item-total {
    width: 120px;
    text-align: right;
}

.table-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-item {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.stat-item:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
}

.stat-item-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    user-select: none;
}

.stat-item-header:hover {
    background: #f8f9fa;
}

.stat-item-name {
    flex: 1;
    font-weight: 500;
    color: #2c3e50;
}

.wiki-link {
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s ease;
}

.wiki-link:hover {
    color: #2980b9;
    text-decoration: underline;
}

.stat-item-total {
    width: 120px;
    text-align: right;
    font-weight: 600;
    color: #34495e;
}

.expand-icon {
    margin-left: 10px;
    font-size: 0.8rem;
    color: #6c757d;
    transition: transform 0.3s ease;
}

.stat-item.expanded .expand-icon {
    transform: rotate(180deg);
}

.stat-item-players {
    display: none;
    padding: 0 20px 20px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.stat-item.expanded .stat-item-players {
    display: block;
}

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

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

.player-name {
    font-weight: 500;
    color: #34495e;
}

.player-value {
    font-weight: 600;
    color: #2c3e50;
}

.pagination {
    display: flex;
    justify-content: center;
    text-align: center;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    border: 1px solid #e8f4fd;
}

.pagination button {
    background: #3498db;
    color: white;
    text-align: center;
    width: 100%;
    max-width: 150px;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

.pagination button:hover:not(:disabled) {
    background: #2980b9;
}

.pagination button:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

#page-info {
    font-weight: 500;
    color: #34495e;
    min-width: 120px;
    text-align: center;
}

@media (min-width: 1024px) {
    .stats-table {
        max-width: 800px;
        margin: 0 auto;
    }
}

@media (min-width: 768px) {
    .player-name {
        margin-left: 20px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
        margin: 10px;
    }
    
    h1 {
        font-size: 2rem;
        margin-bottom: 30px;
    }
    
    .tabs {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .tab-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
    
    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    #search-input {
        min-width: auto;
    }
    
    .stat-item-header {
        padding: 12px 15px;
        flex-wrap: wrap;
    }
    
    .stat-item-name {
        font-size: 0.9rem;
    }
    
    .stat-item-total {
        width: 80px;
        font-size: 0.9rem;
    }
    
    .item-total {
        width: 80px;
    }
    
    .stat-item-players {
        padding: 0 15px 15px 15px;
    }
    
    .player-stat {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .pagination {
        flex-direction: column;
        gap: 15px;
    }
    
    .pagination button {
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.7rem;
    }
    
    .stats-controls {
        padding: 20px;
    }
    
    .stats-content {
        padding: 20px;
    }
    
    .tab-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    #search-input,
    #sort-select {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    .stat-item-header {
        padding: 10px 12px;
    }
    
    .stat-item-name {
        font-size: 0.85rem;
    }
    
    .stat-item-total {
        font-size: 0.85rem;
    }
    
    .stat-item-players {
        padding: 0 12px 12px 12px;
    }
    
    .player-stat {
        font-size: 0.85rem;
    }

    .pagination button {
        max-width: none;
    }
}
