.stats-container-outer {
    min-height: 100vh;
    padding-bottom: 50px; 
    flex-direction: column;
}

.stats-container {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #8b734b;
    border-radius: 8px;
    backdrop-filter: blur(2px);
    max-width: 1200px;
    margin: 130px auto 30px; 
    padding: 30px;
    animation: ancient-reveal 0.5s ease-out forwards;
    flex: 1;
    overflow-y: auto; 
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.stats-header h2 {
    font-family: 'Orbitron', sans-serif;
    color: #ffd700;
    font-size: 2rem;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.server-select select {
    background: rgba(139, 115, 75, 0.2);
    border: 1px solid #8b734b;
    color: #ffd700;
    padding: 8px 16px;
    font-family: 'Orbitron', sans-serif;
    border-radius: 4px;
    cursor: pointer;
}

.stats-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.tab-btn {
    background: rgba(139, 115, 75, 0.2);
    border: 1px solid #8b734b;
    color: #8b734b;
    padding: 10px 20px;
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: ancient-reveal 0.5s ease-out forwards;
}

.tab-btn:hover, .tab-btn.active {
    background: rgba(139, 115, 75, 0.4);
    color: #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.2);
}

.stats-content {
    display: none;
}

.stats-content.active {
    display: block;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.stats-table th, .stats-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid rgba(139, 115, 75, 0.3);
    color: #8b734b;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
}

.stats-table th {
    color: #ffd700;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(0, 0, 0, 0.3);
}

.stats-table tbody tr {
    transition: all 0.3s ease;
}

.stats-table tbody tr:hover {
    background: rgba(139, 115, 75, 0.1);
}

@media (max-width: 768px) {
    .stats-container-outer {
        padding-top: 120px; 
    }
    
    .stats-container {
        margin: 0 15px 30px;
        padding: 15px;
    }

    .stats-table {
        display: block;
        overflow-x: auto;
    }

    .tab-btn {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}

.general-stats {
    display: grid;
    gap: 20px;
}

.stats-row {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #8b734b;
    padding: 20px;
    border-radius: 4px;
}

.stats-row h3 {
    color: #ffd700;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    margin-bottom: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(139, 115, 75, 0.3);
}

.stat-label {
    color: #8b734b;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
}

.stat-value {
    color: #ffd700;
    font-weight: bold;
}

.castles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 10px;
}

.race-stats {
    margin-top: 20px;
}

.race-bar {
    display: flex;
    align-items: center;
    margin: 10px 0;
}

.race-name {
    width: 120px;
    color: #aa8e5e;
    font-family: 'Rajdhani', sans-serif;
}

.race-count {
    width: 50px;
    text-align: right;
    margin-right: 15px;
    color: #aa8e5e;
}

.race-bar-outer {
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.3);
    height: 20px;
    border-radius: 4px;
    overflow: hidden;
}

.race-bar-inner {
    height: 100%;
    background: linear-gradient(45deg, #8b734b, #c89900);
    transition: width 0.3s ease;
}

.race-percentage {
    width: 60px;
    text-align: right;
    color: #ffd700;
    margin-left: 15px;
}

.gender-stats {
    margin-top: 20px;
}

.gender-bar {
    display: flex;
    align-items: center;
    margin: 10px 0;
}

.gender-name {
    width: 120px;
    color: #aa8e5e;
    font-family: 'Rajdhani', sans-serif;
}

.gender-count {
    width: 50px;
    text-align: right;
    margin-right: 15px;
    color: #aa8e5e;
}

.gender-bar-outer {
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.3);
    height: 20px;
    border-radius: 4px;
    overflow: hidden;
}

.gender-bar-inner {
    height: 100%;
    transition: width 0.3s ease;
}

.gender-bar-inner.male {
    background: linear-gradient(45deg, #8b734b, #c89900);
}

.gender-bar-inner.female {
    background: linear-gradient(45deg, #8b734b, #c89900);
}

.gender-percentage {
    width: 60px;
    text-align: right;
    color: #ffd700;
    margin-left: 15px;
}